#! /bin/sh # # chkconfig: 2345 80 20 # description: memcached - memory caching daemon # processname: /usr/bin/memcached # pidfile: /var/run/memcached.pid # source function library WITHOUT_RC_COMPAT=1 . /etc/init.d/functions DAEMON=/usr/bin/memcached DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached NAME=memcached DESC=memcached LOCKFILE=/var/lock/$NAME PIDFILE=/var/run/$NAME.pid RETVAL=0 test -x $DAEMON || exit 0 test -x $DAEMONBOOTSTRAP || exit 0 start() { start_daemon --lockfile "$LOCKFILE" --expect-user memcached -- "$DAEMONBOOTSTRAP" RETVAL=$? return "$RETVAL" } stop() { msg_stopping "$DESC" stop_daemon --expect-user memcached --pidfile "$PIDFILE" -- "$DAEMON" RETVAL=$? return "$RETVAL" rm -f "$PIDFILE" } restart() { stop sleep 1 start RETVAL=$? return "$RETVAL" } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; condrestart|condreload) if [ -e "$LOCKFILE" ]; then restart fi ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; status) status --lockfile "$LOCKFILE" --pidfile "$PIDFILE" --expect-user memcached --name "$DESC" -- "$DESC" RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" RETVAL=1 esac exit $RETVAL