aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/utils/redis_init_script
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:40:55 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:40:55 +0100
commit5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda (patch)
tree1acdfa5220cd13b7be43a2a01368e80d306473ca /examples/redis-unstable/utils/redis_init_script
parentc7ab12bba64d9c20ccd79b132dac475f7bc3923e (diff)
downloadcrep-5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda.tar.gz
Add Redis source code for testing
Diffstat (limited to 'examples/redis-unstable/utils/redis_init_script')
-rwxr-xr-xexamples/redis-unstable/utils/redis_init_script50
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/redis-unstable/utils/redis_init_script b/examples/redis-unstable/utils/redis_init_script
new file mode 100755
index 0000000..006db87
--- /dev/null
+++ b/examples/redis-unstable/utils/redis_init_script
@@ -0,0 +1,50 @@
1#!/bin/sh
2#
3# Simple Redis init.d script conceived to work on Linux systems
4# as it does use of the /proc filesystem.
5
6### BEGIN INIT INFO
7# Provides: redis_6379
8# Default-Start: 2 3 4 5
9# Default-Stop: 0 1 6
10# Short-Description: Redis data structure server
11# Description: Redis data structure server. See https://redis.io
12### END INIT INFO
13
14REDISPORT=6379
15EXEC=/usr/local/bin/redis-server
16CLIEXEC=/usr/local/bin/redis-cli
17
18PIDFILE=/var/run/redis_${REDISPORT}.pid
19CONF="/etc/redis/${REDISPORT}.conf"
20
21case "$1" in
22 start)
23 if [ -f $PIDFILE ]
24 then
25 echo "$PIDFILE exists, process is already running or crashed"
26 else
27 echo "Starting Redis server..."
28 $EXEC $CONF
29 fi
30 ;;
31 stop)
32 if [ ! -f $PIDFILE ]
33 then
34 echo "$PIDFILE does not exist, process is not running"
35 else
36 PID=$(cat $PIDFILE)
37 echo "Stopping ..."
38 $CLIEXEC -p $REDISPORT shutdown
39 while [ -x /proc/${PID} ]
40 do
41 echo "Waiting for Redis to shutdown ..."
42 sleep 1
43 done
44 echo "Redis stopped"
45 fi
46 ;;
47 *)
48 echo "Please use start or stop as first argument"
49 ;;
50esac