updated on Thu Jan 19 04:14:35 UTC 2012
[aur-mirror.git] / gearman / gearmand.init
blobc6735a224018fc0b2ad2408d533169d22ebf25df
1 #!/bin/bash
2 # Gearman startup script
3 # (C) 2009 - John Gerritse
4 # for Arch Linux
5 #####################################
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 # source application-specific settings
10 [ -f /etc/conf.d/gearmand ] && . /etc/conf.d/gearmand
12 DAEMONBIN="/usr/sbin/gearmand"
13 DAEMONOPTS="-u gearman"
14 PID=`pidof -o %PPID /usr/sbin/gearmand`
16 case "$1" in
17 start)
18 stat_busy "Starting gearman daemon "
19 if [ -z "$PID" ]; then
20 $DAEMONBIN $DAEMONOPTS -d $GEARMAN_OPTS
21 else
22 false
24 if [ $? -gt 0 ]; then
25 stat_fail
26 else
27 add_daemon gearmand
28 stat_done
31 stop)
32 stat_busy "Stopping gearman daemon"
33 [ ! -z "$PID" ] && kill $PID &> /dev/null
34 if [ $? -gt 0 ]; then
35 stat_fail
36 else
37 rm_daemon gearmand
38 stat_done
41 restart)
42 $0 stop
43 sleep 2
44 $0 start
47 echo "usage: $0 {start|stop|restart}"
48 esac
49 exit 0