Skip to content

Instantly share code, notes, and snippets.

@seyfer

seyfer/gearmand

Created Feb 3, 2015
Embed
What would you like to do?
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