Skip to content

Instantly share code, notes, and snippets.

@finger-berlin
Created February 29, 2012 16:35
Show Gist options
  • Save finger-berlin/1942295 to your computer and use it in GitHub Desktop.
Save finger-berlin/1942295 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
@finger-berlin
Copy link
Author

Prereq.:

brew install beanstalkd

... have fun!

@JannieT
Copy link

JannieT commented Aug 5, 2016

Cool! Very helpful. If gist had pull requests, I would add:

show)
    # list-tubes | use default | peek-ready | stats
    echo "stats-tube default" | nc -c localhost 11300
;;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment