3 # System V init script in charge of starting/stopping beanstalkd
6 # description: beanstalkd is a simple, fast work queue
7 # processname: beanstalkd
8 # config: /etc/sysconfig/beanstalkd
9 # pidfile: /var/run/beanstalkd/beanstalkd.pid
12 # Provides: beanstalkd
13 # Required-Start: $local_fs $network $remote_fs
14 # Required-Stop: $local_fs $network $remote_fs
15 # Default-Stop: 0 1 2 6
16 # Short-Description: start and stop beanstalkd
17 # Description: beanstalkd is a simple, fast work queue
20 # Source function library
21 .
/etc
/rc.d
/init.d
/functions
23 # Source networking configuration
24 .
/etc
/sysconfig
/network
26 # Check that networking is up
27 [ "$NETWORKING" = "no" ] && exit
29 exec="/usr/bin/beanstalkd"
30 prog
=$
(basename $exec)
32 # Default options, overruled by items in sysconfig
33 BEANSTALKD_ADDR
=127.0.0.1
35 BEANSTALKD_USER
=beanstalkd
37 [ -e /etc
/sysconfig
/$prog ] && .
/etc
/sysconfig
/$prog
39 lockfile
=/var
/lock
/subsys
/$prog
42 [ -x $exec ] ||
exit 5
43 echo -n $
"Starting $prog: "
45 options
="-l $BEANSTALKD_ADDR -p $BEANSTALKD_PORT -u $BEANSTALKD_USER"
47 [ -n "$BEANSTALKD_MAX_JOB_SIZE" ] && options
="$options -z $BEANSTALKD_MAX_JOB_SIZE"
49 if [ -n "$BEANSTALKD_BINLOG_DIR" ]; then
50 if [ ! -d "$BEANSTALKD_BINLOG_DIR" ]; then
51 echo "Creating binlog directory ($BEANSTALKD_BINLOG_DIR)"
52 mkdir
-p $BEANSTALKD_BINLOG_DIR
53 chown
$BEANSTALKD_USER:$BEANSTALKD_USER $BEANSTALKD_BINLOG_DIR
56 options
="$options -b $BEANSTALKD_BINLOG_DIR"
58 if [ -n "$BEANSTALKD_BINLOG_FSYNC_PERIOD" ]; then
59 options
="$options -f $BEANSTALKD_BINLOG_FSYNC_PERIOD"
64 if [ -n "$BEANSTALKD_BINLOG_SIZE" ]; then
65 options
="$options -s $BEANSTALKD_BINLOG_SIZE"
69 daemon
"nohup $exec $options > /dev/null 2>&1 &"
72 [ $retval -eq 0 ] && touch $lockfile
77 echo -n $
"Stopping $prog: "
81 [ $retval -eq 0 ] && rm -f $lockfile
99 # Run checks to determine if the service is running or use generic status
104 rh_status
>/dev
/null
2>&1
109 rh_status_q
&& exit 0
113 rh_status_q ||
exit 0
120 rh_status_q ||
exit 7
129 condrestart|try-restart
)
130 rh_status_q ||
exit 0
134 echo $
"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"