Skip to content

Instantly share code, notes, and snippets.

@amandasaffer
Forked from finger-berlin/beanstald.sh
Created July 21, 2016 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amandasaffer/b6576e83dcc717267a15c5fd97e295eb to your computer and use it in GitHub Desktop.
Save amandasaffer/b6576e83dcc717267a15c5fd97e295eb to your computer and use it in GitHub Desktop.
OSX script for easy start & stop beanstalkd (brew version)
#!/bin/sh
daemon=beanstalkd
executable=/usr/local/bin/$daemon
port=11300
waldir=/usr/local/var/beanstalkd
logfile=/usr/local/var/log/beanstalkd.log
interface="127.0.0.1"
params="-l $interface -p $port -b $waldir"
if [ -d $waldir ]; then true ; else mkdir -p $waldir || echo "ERROR: can't create $waldir"; fi
if [ -d $waldir ]; then true ; else echo "ERROR: $waldir does not exist"; fi
case "$1" in
start)
$executable $params >> $logfile 2>&1 &
[ $? -eq 0 ] && echo "$daemon started..."
;;
stop)
killall $daemon
[ $? -eq 0 ] && echo "$daemon stopped..."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 (start|stop|restart)"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment