Skip to content

Instantly share code, notes, and snippets.

@mbarcia
Created November 4, 2015 09:25
Show Gist options
  • Save mbarcia/ec64ce910f246228f2b2 to your computer and use it in GitHub Desktop.
Save mbarcia/ec64ce910f246228f2b2 to your computer and use it in GitHub Desktop.
/etc/init.d/memcached for CentOS 5
#!/bin/sh
#
# memcached Startup script for memcached processes
#
# chkconfig: - 90 10
# description: Memcache provides fast memory based storage.
# processname: memcached
# These mappings correspond one-to-one with Drupal's settings.php file.
[ -f memcached ] || exit 0
prog="memcached"
start() {
echo -n $"Starting $prog "
# Default cache.
memcached -m 64 -l 0.0.0.0 -p 11212 -d -u nobody
RETVAL=$?
echo
return $RETVAL
}
stop() {
if test "x`pidof memcached`" != x; then
echo -n $"Stopping $prog "
killall memcached
echo
fi
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if test "x`pidof memcached`" != x; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
exit 1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment