mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-25 10:03:03 +01:00
43 lines
628 B
Text
43 lines
628 B
Text
|
#!/bin/sh
|
||
|
#
|
||
|
# /etc/rc.d/rc.memcached - start/stop/restart memcached service.
|
||
|
# Contributed by Miguel De Anda <miguel@thedeanda.com>
|
||
|
#
|
||
|
# Please add this script to rc.local and rc.local_shutdown
|
||
|
# to automatically start and stop the memcached service.
|
||
|
#
|
||
|
|
||
|
PID="/var/run/memcached.pid"
|
||
|
USER="nobody"
|
||
|
|
||
|
memcached_start() {
|
||
|
memcached -d -u $USER -P $PID
|
||
|
}
|
||
|
|
||
|
memcached_stop() {
|
||
|
kill $(cat $PID)
|
||
|
}
|
||
|
|
||
|
memcached_restart() {
|
||
|
memcached_stop
|
||
|
sleep 2
|
||
|
memcached_start
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
'start')
|
||
|
memcached_start
|
||
|
;;
|
||
|
'stop')
|
||
|
memcached_stop
|
||
|
;;
|
||
|
'restart')
|
||
|
memcached_restart
|
||
|
;;
|
||
|
*)
|
||
|
echo "USAGE: $0 start|stop|restart"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
|