mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
e2cb5e2f9f
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
61 lines
957 B
Bash
61 lines
957 B
Bash
#!/bin/sh
|
|
#
|
|
# Redict startup script for Slackware Linux
|
|
|
|
PORT=6379
|
|
SERV=/usr/bin/redict-server
|
|
CLI=/usr/bin/redict-cli
|
|
PIDFILE=/var/run/redict_${PORT}.pid
|
|
CONF=/etc/redict/redict.conf
|
|
|
|
redict_start() {
|
|
if [ ! -r $CONF ]; then
|
|
echo "$CONF does not appear to exist. Abort."
|
|
exit 1
|
|
fi
|
|
|
|
if [ -s $PIDFILE ]; then
|
|
echo "Redict appears to be already running?"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Starting Redict server..."
|
|
$SERV $CONF
|
|
}
|
|
|
|
redict_stop() {
|
|
if [ ! -s $PIDFILE ]; then
|
|
echo "$PIDFILE does not exist or is empty."
|
|
exit 1
|
|
fi
|
|
|
|
PID=$(cat $PIDFILE)
|
|
echo -n "Stopping Redict server..."
|
|
$CLI -p $PORT shutdown
|
|
while [ -d /proc/$PID ]; do
|
|
sleep 1
|
|
echo -n "."
|
|
done
|
|
echo " done"
|
|
}
|
|
|
|
redict_restart() {
|
|
redict_stop
|
|
sleep 3
|
|
redict_start
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
redict_start
|
|
;;
|
|
stop)
|
|
redict_stop
|
|
;;
|
|
restart)
|
|
redict_restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|