Redis 介绍安装
#vi /etc/init.d/redis#!/bin/bash
#redis - this script can start|stop the redis service.
#chkconfig: -8911
#description: redis is a presistent key-value store Database
# processname:redis-server
# config: /etc/redis.conf
# config: /opt/redis/bin/redis-server
# pidfile: /var/run/redis.pid
# source function library.
. /etc/rc.d/init.d/functions
# source networking configuration.
. /etc/sysconfig/network
# check that networking is up.
[ "$NETWORKING" = "no"] && exit 0
REDIS=/opt/redis/bin/redis-server
PROG=$(basename $REDIS)
CONFIG=/etc/redis.conf
PIDFILE=/var/run/redis.pid
LOCKFILE=/var/lock/subsys/redis
start() {
[ -x $REDIS ] || exit 3
[ -f $CONFIG ] || exit 4
echo -n $"Starting $PROG: "
daemon $REDIS $CONFIG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop() {
echo -n $"Stopping $REDIS: "
killproc $PROG -QUIT
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading $PROG: "
killproc $REDIS -HUP
RETVAL=$?
echo
}
status() {
status$PROG
RETVAL=$?
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
reload)
reload
;;
*)
echo $"Useage: $PROG {start|stop|status|reload|restart}"
RETVAL=2
esac
exit $RETVAL
#chmod +x /etc/init.d/redis
页:
[1]