-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredis_service.sh
More file actions
executable file
路44 lines (42 loc) 路 1.31 KB
/
Copy pathredis_service.sh
File metadata and controls
executable file
路44 lines (42 loc) 路 1.31 KB
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
#!/bin/sh
REDIS_SERVICE_ALL_EXPORT_PATH=/home/devuser/monitoring/redis-5.0.7/
SERVICE_NAME=redis-service-all-service
# See how we were called.
case "$1" in
start)
# Start daemon.
echo "馃 Starting $SERVICE_NAME";
# nohup $REDIS_SERVICE_ALL_EXPORT_PATH/src/redis-server $REDIS_SERVICE_ALL_EXPORT_PATH/redis.conf --protected-mode no &> /dev/null &
$REDIS_SERVICE_ALL_EXPORT_PATH/src/redis-server $REDIS_SERVICE_ALL_EXPORT_PATH/redis.conf --protected-mode no
;;
stop)
# Stop daemons.
echo "馃 Shutting down $SERVICE_NAME";
pid=`ps ax | grep -i '/src/redis-server' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
kill -9 $pid
else
echo "馃 $SERVICE_NAME was not Running"
fi
;;
restart)
$0 stop
sleep 2
$0 start
# Need to wait for two seconds to start python script via Fabric
sleep 2
;;
status)
pid=`ps ax | grep -i '/src/redis-server' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "馃 $SERVICE_NAME is Running as PID: $pid"
else
echo "馃 $SERVICE_NAME is not Running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac