Created
January 21, 2009 09:47
-
-
Save peterc/49902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# memcached This shell script takes care of starting and stopping | |
# standalone memcached. | |
# | |
# chkconfig: - 80 12 | |
# description: memcached is a high-performance, distributed memory | |
# object caching system, generic in nature, but | |
# intended for use in speeding up dynamic web | |
# applications by alleviating database load. | |
# processname: memcached | |
# config: /etc/memcached.conf | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/local/bin/memcached | |
DAEMONBOOTSTRAP=/usr/local/bin/start-memcached | |
DAEMONCONF=/etc/memcached.conf | |
NAME=memcached | |
DESC=memcached | |
PIDFILE=/var/run/$NAME.pid | |
[ -x $DAEMON ] || exit 0 | |
[ -x $DAEMONBOOTSTRAP ] || exit 0 | |
RETVAL=0 | |
start() { | |
echo -n $"Starting $DESC: " | |
daemon $DAEMONBOOTSTRAP $DAEMONCONF | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && touch $PIDFILE | |
echo | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Shutting down $DESC: " | |
killproc $NAME | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && rm -f $PIDFILE | |
return $RETVAL | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|reload) | |
stop | |
start | |
RETVAL=$? | |
;; | |
status) | |
status $prog | |
RETVAL=$? | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|status}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment