Created
February 29, 2012 16:35
-
-
Save finger-berlin/1942295 to your computer and use it in GitHub Desktop.
OSX script for easy start & stop beanstalkd (brew version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
Cool! Very helpful. If gist had pull requests, I would add: