-
-
Save thash/3688981 to your computer and use it in GitHub Desktop.
Init.d Redis script for Fedora16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Init file for Redis server | |
# | |
# chkconfig: - 98 02 | |
# description: Persistent key-value db | |
# | |
# processname: redis | |
# config: /etc/redis.conf | |
# pidfile: /var/run/redis.pid | |
# Short-Description: Persistent key-value db | |
# Source function library. | |
. /etc/init.d/functions | |
### Default variables | |
CONFIG="/etc/redis.conf" | |
prog="redis-server" | |
PATH=/usr/local/bin:$PATH | |
export PATH | |
# Check if requirements are met | |
[ -x /usr/local/bin/redis-server ] || exit 1 | |
[ -r "$CONFIG" ] || exit 1 | |
RETVAL=0 | |
start() { | |
echo -n $"Starting $prog: " | |
daemon $prog $CONFIG | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Shutting down $prog: " | |
killproc $prog | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog | |
return $RETVAL | |
} | |
restart() { | |
stop | |
start | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
reload) | |
restart | |
;; | |
condrestart) | |
[ -e /var/lock/subsys/$prog ] && restart | |
RETVAL=$? | |
;; | |
status) | |
status $prog | |
RETVAL=$? | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" | |
RETVAL=1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment