diff options
author | Yth - Arnaud <yth@ythogtha.org> | 2024-04-04 11:04:19 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-04-04 15:10:14 +0700 |
commit | 5f4ed12c1a639f6500413fc49288b00f5ac25621 (patch) | |
tree | 574f48c0b74c9b75d5eae898ebd5c45799e91dd3 /system/valkey/rc.valkey.new | |
parent | d9cfbff954cfa48677d32b14d89f610a26ad109d (diff) |
system/valkey: Added (Fork of redis).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/valkey/rc.valkey.new')
-rw-r--r-- | system/valkey/rc.valkey.new | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/system/valkey/rc.valkey.new b/system/valkey/rc.valkey.new new file mode 100644 index 0000000000000..aca97e59a77da --- /dev/null +++ b/system/valkey/rc.valkey.new @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Valkey startup script for Slackware Linux + +PORT=6379 +SERV=/usr/bin/valkey-server +CLI=/usr/bin/valkey-cli +PIDFILE=/var/run/valkey_${PORT}.pid +CONF=/etc/valkey/valkey.conf + +valkey_start() { + if [ ! -r $CONF ]; then + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PIDFILE ]; then + echo "Valkey appears to be already running?" + exit 1 + fi + + echo "Starting Valkey server..." + $SERV $CONF +} + +valkey_stop() { + if [ ! -s $PIDFILE ]; then + echo "$PIDFILE does not exist or is empty." + exit 1 + fi + + PID=$(cat $PIDFILE) + echo -n "Stopping Valkey server..." + $CLI -p $PORT shutdown + while [ -d /proc/$PID ]; do + sleep 1 + echo -n "." + done + echo " done" +} + +valkey_restart() { + valkey_stop + sleep 3 + valkey_start +} + +case "$1" in + start) + valkey_start + ;; + stop) + valkey_stop + ;; + restart) + valkey_restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac |