Created
April 2, 2012 04:28
-
-
Save sowawa/2280738 to your computer and use it in GitHub Desktop.
memcached start/stop script for rackhub
This file contains hidden or 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/sh | |
# | |
# chkconfig: - 55 45 | |
# description: The memcached daemon is a network memory cache service. | |
# processname: memcached | |
# config: /etc/sysconfig/memcached | |
# Source function library. | |
# . /etc/rc.d/init.d/functions | |
PORT=11211 | |
USER=nobody | |
MAXCONN=1024 | |
CACHESIZE=16 | |
LISTEN="127.0.0.1" | |
# LISTEN="0.0.0.0" | |
OPTIONS="" | |
# if [ -f /etc/sysconfig/memcached ];then | |
# . /etc/sysconfig/memcached | |
# fi | |
# Check that networking is up. | |
# if [ "$NETWORKING" = "no" ] | |
# then | |
# exit 0 | |
# fi | |
# RETVAL=0 | |
prog="/usr/local/bin/memcached" | |
start () { | |
echo $"Starting $prog: " | |
# insure that /var/run/memcached has proper permissions | |
if ! [ -e /var/run/memcached ];then | |
mkdir /var/run/memcached | |
fi | |
chown $USER /var/run/memcached | |
$prog -d -l $LISTEN -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS | |
# RETVAL=$? | |
# echo | |
#[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached | |
} | |
stop () { | |
echo $"Stopping $prog: " | |
start-stop-daemon --stop --quiet --exec $prog | |
# RETVAL=$? | |
# echo | |
# if [ $RETVAL -eq 0 ] ; then | |
# rm -f /var/lock/subsys/memcached | |
# rm -f /var/run/memcached.pid | |
# fi | |
rm -f /var/run/memcached/memcached.pid | |
} | |
restart () { | |
stop | |
start | |
} | |
# See how we were called. | |
case "$1" in | |
start ) start ;; | |
stop ) stop ;; | |
# status) | |
# status memcached | |
# ;; | |
restart|reload ) restart ;; | |
# condrestart) | |
# [ -f /var/lock/subsys/memcached ] && restart || : | |
# ;; | |
* ) echo $"Usage: $0 {start|stop|status|restart|reload}" ;; | |
# echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" | |
# exit 1 | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment