2010-03-07 18:22:11 +01:00
|
|
|
Index: utils/redis_init_script
|
|
|
|
===================================================================
|
|
|
|
--- utils/redis_init_script.orig
|
|
|
|
+++ utils/redis_init_script
|
2010-03-09 15:25:50 +01:00
|
|
|
@@ -1,36 +1,64 @@
|
2010-02-24 23:49:48 +01:00
|
|
|
#!/bin/sh
|
2010-03-09 15:25:50 +01:00
|
|
|
+#
|
|
|
|
+# /etc/init.d/redis
|
|
|
|
+#
|
2010-02-24 23:49:48 +01:00
|
|
|
+### BEGIN INIT INFO
|
|
|
|
+# Provides: redis
|
|
|
|
+# Required-Start: $syslog $remote_fs
|
|
|
|
+# Should-Start:
|
|
|
|
+# Required-Stop: $syslog $remote_fs
|
|
|
|
+# Should-Stop:
|
2010-03-09 15:25:50 +01:00
|
|
|
+# Default-Start: 3 4 5
|
2010-02-24 23:49:48 +01:00
|
|
|
+# Default-Stop: 0 1 2 6
|
|
|
|
+# Short-Description: Redis server
|
2010-03-09 15:25:50 +01:00
|
|
|
+# Description: Starts and stops the Redis daemon
|
2010-02-24 23:49:48 +01:00
|
|
|
+### END INIT INFO
|
2010-03-09 15:25:50 +01:00
|
|
|
+
|
|
|
|
+. /etc/rc.status
|
2010-02-24 23:49:48 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2010-03-09 15:25:50 +01:00
|
|
|
- if [ -f $PIDFILE ]
|
|
|
|
- then
|
2010-03-08 00:11:23 +01:00
|
|
|
- echo -n "$PIDFILE exists, process is already running or crashed\n"
|
2010-03-09 15:25:50 +01:00
|
|
|
- else
|
2010-03-08 00:11:23 +01:00
|
|
|
- echo -n "Starting Redis server...\n"
|
2010-03-08 00:42:36 +01:00
|
|
|
- $EXEC $CONF
|
2010-03-09 15:25:50 +01:00
|
|
|
- fi
|
|
|
|
+ echo -n "Starting service Redis "
|
2010-05-17 16:27:43 +02:00
|
|
|
+ /sbin/startproc -u redis -g redis -p $PIDFILE -s -e $EXEC $CONF
|
2010-03-09 15:25:50 +01:00
|
|
|
+ rc_status -v
|
2010-03-08 00:11:23 +01:00
|
|
|
;;
|
|
|
|
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-09 15:25:50 +01:00
|
|
|
+ echo -n "Stopping service Redis ..."
|
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:42:36 +01:00
|
|
|
- echo "Waiting for Redis to shutdown ..."
|
|
|
|
sleep 1
|
2010-03-08 00:22:27 +01:00
|
|
|
done
|
|
|
|
rm $PIDFILE
|
2010-03-08 00:42:36 +01:00
|
|
|
- echo "Redis stopped"
|
|
|
|
fi
|
|
|
|
+ rc_status -v
|
2010-03-09 15:25:50 +01:00
|
|
|
+ ;;
|
|
|
|
+ restart)
|
|
|
|
+ $0 stop
|
|
|
|
+ $0 start
|
|
|
|
+ ;;
|
|
|
|
+ reload)
|
|
|
|
+ $0 restart
|
|
|
|
+ ;;
|
2010-03-08 00:11:23 +01:00
|
|
|
+ status)
|
2010-03-09 15:25:50 +01:00
|
|
|
+ echo -n "Checking for service Redis: "
|
|
|
|
+ /sbin/checkproc -p $PIDFILE $EXEC
|
2010-03-08 00:42:36 +01:00
|
|
|
+ rc_status -v
|
2010-03-09 15:25:50 +01:00
|
|
|
;;
|
2010-03-08 00:11:23 +01:00
|
|
|
+ *)
|
2010-03-09 15:25:50 +01:00
|
|
|
+ echo $"Usage: $0 {start|stop|status|restart|reload}"
|
|
|
|
+ exit 1
|
2010-02-24 23:49:48 +01:00
|
|
|
esac
|
2010-03-08 00:22:27 +01:00
|
|
|
+rc_exit
|