Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Created January 16, 2012 00:48
Show Gist options
  • Save philsturgeon/1618268 to your computer and use it in GitHub Desktop.
Save philsturgeon/1618268 to your computer and use it in GitHub Desktop.
Gearman Worker init.d
#!/bin/bash
#
# /etc/init.d/gearman-workers
### BEGIN INIT INFO
# Provides: gearman-workers
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Run gearman workers
### END INIT INFO
start()
{
echo "Starting workers..."
# could this be *.php ?
php /home/ubuntu/workers/resize.php &
echo "Ok.."
exit 2
}
stop()
{
echo "Stoping workers $2"
# NOOOO idea
exit 1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
start
stop
;;
*)
echo "Input [start|stop|restart|force-reload]"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment