1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #!/bin/bash
- #
- # @PACKAGE@ Startup script for the Gearman server
- #
- # chkconfig: - 85 15
- # description: Gearman is a distributed job system.
- # processname: @PACKAGE@
- # config: /etc/sysconfig/@PACKAGE@
- # pidfile: /var/run/@PACKAGE@/gearmand.pid
- #
- ### BEGIN INIT INFO
- # Provides: @PACKAGE@
- # Required-Start: $local_fs $network
- # Required-Stop: $local_fs $network
- # Default-Start:
- # Default-Stop:
- # Short-Description: start and stop the Gearman server
- # Description: Gearman is a distributed job system.
- ### END INIT INFO
- sysconf=@sysconfdir@/sysconfig/@PACKAGE@
- gearmand=@sbindir@/@PACKAGE@
- prog=@PACKAGE@
- # Source function library.
- . /etc/rc.d/init.d/functions
- if [ -f $sysconf ]; then
- . $sysconf
- fi
- [ -z "${PIDFILE}" ] && pidfile="@localstatedir@/run/@PACKAGE@/@PACKAGE@.pid"
- [ -z "${LOCKFILE}" ] && lockfile="@localstatedir@/lock/subsys/@PACKAGE@"
- RETVAL=0
- start() {
- echo -n $"Starting $prog: "
- daemon --pidfile=$pidfile --user=gearmand $gearmand -d $OPTIONS
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && (touch $lockfile; pgrep -f $gearmand > $pidfile)
- return $RETVAL
- }
- stop() {
- echo -n $"Stopping $prog: "
- killproc -p $pidfile $gearmand
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && rm -f $lockfile $pidfile
- }
- reload() {
- echo -n $"Reloading $prog: "
- killproc -p $pidfile $gearmand -SIGHUP
- RETVAL=$?
- echo
- [ $RETVAL = 0 ]
- }
- # See how we were called.
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status -p $pidfile $gearmand
- RETVAL=$?
- ;;
- restart|reload)
- reload
- ;;
- condrestart|try-restart)
- if status -p $pidfile $gearmand >&/dev/null; then
- stop
- start
- fi
- ;;
- *)
- echo $"Usage: $prog {start|stop|restart|reload|condrestart|status|help}"
- RETVAL=3
- esac
- exit $RETVAL
|