#!/bin/bash # # Init file for redis # FROM:JC # email:jiechao2013@gmail.com # chkconfig:-12 # Description:redis daemon # # processname:redis # config:/opt/redis-2.6.4/redis.conf # pidfil E:/var/run/redis.pid source/etc/init.d/functions & nbsp bin= "/opt/redis/bin" config= "/opt/redis-2.6.4/redis.conf" pidfile= "/var/run/redis.pid" # # Read configuration [-R "$SYSCONFIG"] && source "$SYSCONFIG"  &N Bsp retval=0 prog= "Redis-server" desc= "Redis server" start () {  &NB Sp If [-e $PIDFILE];then echo "$desc already running ..." &NB Sp Exit 1 fi Echo-n $ "Starting $desc:" &NB Sp Daemon $BIN/$pRog $CONFIG & retval=$? echo [ $RETVAL-eq 0] && touch/var/lock/subsys/$prog return $RETVAL } &NB sp; Stop () { Echo-n $ "Stop $desc:" Killproc $prog retval=$?& nbsp echo [$RETVAL-eq 0] && rm-f/var/lock/subsys/$prog $PIDFILE &NB Sp Return $RETVAL } restart () { stop START&NBS P } case "$" in start) start ; stop) stop ;; restart) restart ;; Condrestart) [-e/var/lock/subsys/$prog] && restart RETVAL=$?&NBsp ;; status) status $prog retval=$? ;; *) echo $ "Usage: $ start|stop|restart|condrestart|status}" RETVAL=1&NBS P esac
Exit $RETVAL
from:http://jiechao2012.blog.51cto.com/3251753/1193241