File: valkey_init_script.tpl

package info (click to toggle)
valkey 8.1.4%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,972 kB
  • sloc: ansic: 216,413; tcl: 52,837; sh: 4,516; perl: 4,214; makefile: 2,003; python: 1,397; ruby: 886; cpp: 539; javascript: 30; csh: 7
file content (44 lines) | stat: -rwxr-xr-x 1,053 bytes parent folder | download | duplicates (3)
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

case "$1" in
    start)
        if [ -f $PIDFILE ]
        then
            echo "$PIDFILE exists, process is already running or crashed"
        else
            echo "Starting Valkey server..."
            $EXEC $CONF
        fi
        ;;
    stop)
        if [ ! -f $PIDFILE ]
        then
            echo "$PIDFILE does not exist, process is not running"
        else
            PID=$(cat $PIDFILE)
            echo "Stopping ..."
            $CLIEXEC -p $VALKEYPORT shutdown
            while [ -x /proc/${PID} ]
            do
                echo "Waiting for Valkey to shutdown ..."
                sleep 1
            done
            echo "Valkey stopped"
        fi
        ;;
    status)
        PID=$(cat $PIDFILE)
        if [ ! -x /proc/${PID} ]
        then
            echo 'Valkey is not running'
        else
            echo "Valkey is running ($PID)"
        fi
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Please use start, stop, restart or status as first argument"
        ;;
esac