脚本启动redis

redis 启动脚本
#!/bin/bash
#chkconfig: 2345 10 90
source  /etc/init.d/functions
if [ -f /etc/system/redis ];then
source /etc/system/redis
fi
prog=redis
redis=/usr/local/bin/redis-server
rconf=/usr/local/redis/redis.conf
pidfile=${pidfile-/var/run/redis.pid}
lockfile=${lockfile-/var/lock/subsys/redis}
start() {
    echo -n "Starting $prog"
    daemon $redis  $rconf $OPTIONS
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch $pidfile $lockfile
    echo


}
stop() {
    echo -n "Stoping $prog"
    killproc $redis
    RETVAL=$?
    echo
    [ $RETVAL  -eq 0 ] && rm -rf $pidfile $lockfile


}
reload() {
    echo -n "Reloading $prog"
    killproc  $redis  -HUP
    echo
}
case $1 in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status   $prog

;;
*)
echo "Usage service $prog{start|stop|restart|reload|status}"
;;
esac

你可能感兴趣的:(脚本启动redis)