Skip to content

Instantly share code, notes, and snippets.

@seyfer
Created February 3, 2015 06:59
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 seyfer/f5384b76c8fd258dffdd to your computer and use it in GitHub Desktop.
Save seyfer/f5384b76c8fd258dffdd to your computer and use it in GitHub Desktop.
Gearman Daemon init.d for Debian
#!/bin/sh
# Gearman server and library
# Copyright (C) 2013 Mostafa Amiri
# All rights reserved.
#
# Use and distribution licensed under the BSD license. See
# the COPYING file in this directory for full text.
NAME=gearmand
DAEMON=/usr/local/sbin/gearmand
PIDFILE=/var/run/gearmand.pid
LOGFILE=/var/log/gearmand.log
[ -x $DAEMON ] || exit 0
start()
{
$DAEMON -d -P $PIDFILE -l $LOGFILE
}
stop()
{
kill `cat $PIDFILE`
rm -f $PIDFILE
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
echo -n "${NAME} is "
if start-stop-daemon --stop --quiet --signal 0 --name ${NAME} --pidfile ${PIDFILE}
then
echo "running"
else
echo "not running"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment