2011-10-03 08:48:07 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2012-05-04 11:07:00 +00:00
|
|
|
if [ -f $PIDFILE ]
|
2011-10-03 08:48:07 +00:00
|
|
|
then
|
2014-03-15 13:43:50 +00:00
|
|
|
echo "$PIDFILE exists, process is already running or crashed"
|
2011-10-03 08:48:07 +00:00
|
|
|
else
|
2024-04-24 08:05:11 +00:00
|
|
|
echo "Starting Valkey server..."
|
2014-03-15 13:43:50 +00:00
|
|
|
$EXEC $CONF
|
2011-10-03 08:48:07 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
if [ ! -f $PIDFILE ]
|
|
|
|
then
|
2014-03-15 13:43:50 +00:00
|
|
|
echo "$PIDFILE does not exist, process is not running"
|
2011-10-03 08:48:07 +00:00
|
|
|
else
|
2014-03-15 13:43:50 +00:00
|
|
|
PID=$(cat $PIDFILE)
|
|
|
|
echo "Stopping ..."
|
2024-04-24 08:05:11 +00:00
|
|
|
$CLIEXEC -p $VALKEYPORT shutdown
|
2014-03-15 13:43:50 +00:00
|
|
|
while [ -x /proc/${PID} ]
|
|
|
|
do
|
2024-04-24 08:05:11 +00:00
|
|
|
echo "Waiting for Valkey to shutdown ..."
|
2014-03-15 13:43:50 +00:00
|
|
|
sleep 1
|
|
|
|
done
|
2024-04-24 08:05:11 +00:00
|
|
|
echo "Valkey stopped"
|
2011-10-03 08:48:07 +00:00
|
|
|
fi
|
|
|
|
;;
|
2014-03-15 13:43:50 +00:00
|
|
|
status)
|
2014-10-26 18:09:45 +00:00
|
|
|
PID=$(cat $PIDFILE)
|
|
|
|
if [ ! -x /proc/${PID} ]
|
2014-03-15 13:43:50 +00:00
|
|
|
then
|
2024-04-24 08:05:11 +00:00
|
|
|
echo 'Valkey is not running'
|
2014-03-15 13:43:50 +00:00
|
|
|
else
|
2024-04-24 08:05:11 +00:00
|
|
|
echo "Valkey is running ($PID)"
|
2014-03-15 13:43:50 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
2011-10-03 08:48:07 +00:00
|
|
|
*)
|
2014-03-15 13:43:50 +00:00
|
|
|
echo "Please use start, stop, restart or status as first argument"
|
2011-10-03 08:48:07 +00:00
|
|
|
;;
|
|
|
|
esac
|