aboutsummaryrefslogtreecommitdiff
path: root/network/memcached/rc.memcached
diff options
context:
space:
mode:
authorNishant Limbachia <nishant@mnspace.net>2014-11-21 01:23:21 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-11-21 01:28:38 +0700
commitd5093c172a774f6ca08f012dd83f13ce6a1248a2 (patch)
tree7cbdccbcb0f8e47f2d57ed410c9dff0081b32d32 /network/memcached/rc.memcached
parentb91f3318e9e0a8f9ceae915f60ef21c7ed2c4420 (diff)
network/memcached: Updated for version 1.4.21.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/memcached/rc.memcached')
-rw-r--r--network/memcached/rc.memcached42
1 files changed, 42 insertions, 0 deletions
diff --git a/network/memcached/rc.memcached b/network/memcached/rc.memcached
new file mode 100644
index 0000000000000..4cacb097d4684
--- /dev/null
+++ b/network/memcached/rc.memcached
@@ -0,0 +1,42 @@
+#!/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
+