4 # Provides: mod_gearman_worker
5 # Required-Start: $local_fs
6 # Required-Stop: $local_fs
9 # Default-Start: 2 3 4 5
11 # Short-Description: Start/Stop the mod_gearman worker daemon
14 # Check if Mod-Gearman is enabled in OMD. If not terminate.
17 .
###ROOT###/etc/omd/site.conf
18 if [ "$CONFIG_MOD_GEARMAN" != "on" -o "$CONFIG_GEARMAN_WORKER" != "on" ] ; then
22 DAEMON
=###ROOT###/bin/mod_gearman_worker
24 CONFIG
=###ROOT###/etc/mod-gearman/worker.cfg
25 PIDFILE
=###ROOT###/tmp/run/gearman_worker.pid
30 if [ "$USERID" -eq 0 ]; then
31 mkdir
-p $
(dirname $PIDFILE)
32 chown
$USER: $
(dirname $PIDFILE)
37 echo -n "Starting $NAME..."
38 mkdir
-p ###ROOT###/tmp/run
39 mkdir
-p ###ROOT###/var/log/gearman
40 rm -f ###ROOT###/var/log/mod-gearman/gearman
41 CMD
="$DAEMON -d --config=$CONFIG --pidfile=$PIDFILE"
42 if [ "$USERID" -eq 0 ]; then
43 su
-s $SHELL - $USER -c "$CMD"
54 echo -n "Stopping $NAME..."
55 pid
=`cat $PIDFILE 2>/dev/null`
60 for x
in 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5; do
62 ps
-p $pid > /dev
/null
2>&1 && sleep 1;
64 ps
-p $pid > /dev
/null
2>&1;
75 echo "Reloading $NAME configuration files"
76 pid
=`cat $PIDFILE 2>/dev/null`
77 if [ "$pid" != "" ]; then
82 pid
=`cat $PIDFILE 2>/dev/null`
83 if [ "$pid" != "" ]; then
84 ps
-p $pid > /dev
/null
2>&1
86 echo "$NAME is running with pid $pid"
90 echo "$NAME is not running"
94 $0 stop
&& sleep 1 && $0 start
98 echo "Usage: $NAME {start|stop|status|restart}"