-
Notifications
You must be signed in to change notification settings - Fork 1
/
redis-sentinel
54 lines (49 loc) · 1.09 KB
/
redis-sentinel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
###############
# SysV Init Information
# chkconfig: - 58 74
# description: redis-sentinel is the redis-sentinel daemon.
### BEGIN INIT INFO
# Provides: redis-sentinel
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop redis-sentinel
# Description: Redis daemon
### END INIT INFO
NAME=redis-sentinel
BIN=/usr/local/bin/redis-server # --1--
CONF=/etc/redis/sentinel.conf
SENTINEL_PID=/tmp/redis-sentinel.pid
CMD=$1
start() {
echo "Starting $NAME ..."
# exec 2>&1 $BIN $CONF --sentinel | logger -t sentinel & # --2--
exec 2>&1 $BIN $CONF --sentinel &>/var/log/redis-sentinel.out &
echo $! > "${SENTINEL_PID}";
}
stop() {
PID=`cat $SENTINEL_PID`
echo "Stopping $NAME ($PID) ..."
kill $PID
}
restart() {
echo "Restarting $NAME ..."
stop
start
}
case "$CMD" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage $0 {start|stop|restart}"
esac