2010-03-07 18:22:11 +01:00
|
|
|
Index: utils/redis_init_script
|
|
|
|
===================================================================
|
|
|
|
--- utils/redis_init_script.orig
|
|
|
|
+++ utils/redis_init_script
|
2010-03-08 00:22:27 +01:00
|
|
|
@@ -1,28 +1,44 @@
|
2010-02-24 23:49:48 +01:00
|
|
|
#!/bin/sh
|
|
|
|
+### BEGIN INIT INFO
|
|
|
|
+# Provides: redis
|
|
|
|
+# Required-Start: $syslog $remote_fs
|
|
|
|
+# Should-Start:
|
|
|
|
+# Required-Stop: $syslog $remote_fs
|
|
|
|
+# Should-Stop:
|
|
|
|
+# Default-Start: 3 5
|
|
|
|
+# Default-Stop: 0 1 2 6
|
|
|
|
+# Short-Description: Redis server
|
2010-03-08 00:11:23 +01:00
|
|
|
+# Description: Manages the Redis server
|
2010-02-24 23:49:48 +01:00
|
|
|
+### END INIT INFO
|
|
|
|
|
|
|
|
REDISPORT=6379
|
|
|
|
-EXEC=/usr/local/bin/redis-server
|
|
|
|
+EXEC=/usr/sbin/redis-server
|
|
|
|
|
2010-03-08 00:11:23 +01:00
|
|
|
-PIDFILE=/var/run/redis_${REDISPORT}.pid
|
|
|
|
-CONF="/etc/redis/${REDISPORT}.conf"
|
|
|
|
+PIDFILE=/var/run/redis.pid
|
|
|
|
+CONF=/etc/redis.conf
|
2010-03-08 00:22:27 +01:00
|
|
|
+
|
|
|
|
+. /etc/rc.status
|
2010-03-08 00:11:23 +01:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
if [ -f $PIDFILE ]
|
|
|
|
then
|
|
|
|
- echo -n "$PIDFILE exists, process is already running or crashed\n"
|
2010-03-08 00:22:27 +01:00
|
|
|
+ echo -n "$PIDFILE exists, process is already running or crashed"
|
|
|
|
+ rc_failed
|
2010-03-05 13:30:26 +01:00
|
|
|
else
|
2010-03-08 00:11:23 +01:00
|
|
|
- echo -n "Starting Redis server...\n"
|
2010-03-08 00:22:27 +01:00
|
|
|
+ echo -n "Starting Redis server..."
|
2010-03-08 00:11:23 +01:00
|
|
|
$EXEC $CONF
|
2010-03-08 00:22:27 +01:00
|
|
|
+ rc_status -v
|
2010-03-08 00:11:23 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
if [ ! -f $PIDFILE ]
|
|
|
|
then
|
|
|
|
- echo -n "$PIDFILE does not exist, process is not running\n"
|
2010-03-08 00:22:27 +01:00
|
|
|
+ echo -n "$PIDFILE does not exist, process is not running"
|
|
|
|
+ rc_failed
|
2010-03-08 00:11:23 +01:00
|
|
|
else
|
|
|
|
- echo -n "Stopping ...\n"
|
2010-03-07 18:22:11 +01:00
|
|
|
- echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT &
|
2010-03-08 00:22:27 +01:00
|
|
|
+ echo -n "Stopping ..."
|
2010-03-08 00:11:23 +01:00
|
|
|
+ echo -e "SHUTDOWN\r" | netcat localhost $REDISPORT &
|
2010-03-05 13:30:26 +01:00
|
|
|
PID=$(cat $PIDFILE)
|
|
|
|
while [ -x /proc/${PIDFILE} ]
|
|
|
|
do
|
2010-03-08 00:22:27 +01:00
|
|
|
@@ -31,6 +47,22 @@ case "$1" in
|
|
|
|
done
|
|
|
|
rm $PIDFILE
|
2010-02-24 23:49:48 +01:00
|
|
|
echo "Redis stopped"
|
2010-03-08 00:22:27 +01:00
|
|
|
+ rc_status -v
|
|
|
|
+ fi
|
|
|
|
+ ;;
|
2010-03-08 00:11:23 +01:00
|
|
|
+ status)
|
|
|
|
+ if [ ! -f $PIDFILE ]
|
|
|
|
+ then
|
2010-03-08 00:22:27 +01:00
|
|
|
+ echo -n "$PIDFILE does not exist, process is not running"
|
|
|
|
+ rc_status -v
|
2010-03-08 00:11:23 +01:00
|
|
|
+ else
|
2010-03-08 00:22:27 +01:00
|
|
|
+ echo -n "$PIDFILE does exist, process is running"
|
|
|
|
+ rc_status -v
|
|
|
|
fi
|
|
|
|
;;
|
2010-03-08 00:11:23 +01:00
|
|
|
+ *)
|
|
|
|
+ echo "Usage: $0 [start|stop|status]"
|
2010-02-24 23:49:48 +01:00
|
|
|
+ ;;
|
|
|
|
esac
|
2010-03-08 00:22:27 +01:00
|
|
|
+
|
|
|
|
+rc_exit
|