mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-18 22:06:04 +01:00
0799e08a7c
Thanks to Marcin Szychowski. Signed-off-by: Audrius Kažukauskas <audrius@neutrino.lt>
61 lines
940 B
Bash
61 lines
940 B
Bash
#!/bin/sh
|
|
#
|
|
# Redis startup script for Slackware Linux
|
|
|
|
PORT=6379
|
|
SERV=/usr/bin/redis-server
|
|
CLI=/usr/bin/redis-cli
|
|
PIDFILE=/var/run/redis_${PORT}.pid
|
|
CONF=/etc/redis/redis.conf
|
|
|
|
redis_start() {
|
|
if [ ! -r $CONF ]; then
|
|
echo "$CONF does not appear to exist. Abort."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -s $PIDFILE ]; then
|
|
echo "Redis appears to be already running?"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Starting Redis server..."
|
|
$SERV $CONF
|
|
}
|
|
|
|
redis_stop() {
|
|
if [ ! -s $PIDFILE ]; then
|
|
echo "$PIDFILE does not exist or is empty."
|
|
exit 1
|
|
fi
|
|
|
|
PID=$(cat $PIDFILE)
|
|
echo -n "Stopping Redis server..."
|
|
$CLI -p $PORT shutdown
|
|
while [ -d /proc/$PID ]; do
|
|
sleep 1
|
|
echo -n "."
|
|
done
|
|
echo " done"
|
|
}
|
|
|
|
redis_restart() {
|
|
redis_stop
|
|
sleep 3
|
|
redis_start
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
redis_start
|
|
;;
|
|
stop)
|
|
redis_stop
|
|
;;
|
|
restart)
|
|
redis_restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|