123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #!/bin/bash
- #
- # gearmand Startup script for the Gearman server
- #
- # chkconfig: - 85 15
- # description: Gearman is a distributed job system.
- # processname: gearmand
- # config: /etc/sysconfig/gearmand
- # pidfile: /var/run/gearmand/gearmand.pid
- #
- ### BEGIN INIT INFO
- # Provides: gearmand
- # 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
- # Source function library.
- . /etc/rc.d/init.d/functions
- if [ -f /etc/sysconfig/gearmand ]; then
- . /etc/sysconfig/gearmand
- fi
- [ -z "${PIDFILE}" ] && pidfile="/var/run/gearmand/gearmand.pid"
- [ -z "${LOCKFILE}" ] && lockfile="/var/lock/subsys/gearmand"
- gearmand=/usr/sbin/gearmand
- prog=gearmand
- 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
- }
- # See how we were called.
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status -p $pidfile $gearmand
- RETVAL=$?
- ;;
- restart|reload)
- stop
- start
- ;;
- 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
|