redis重啟指令碼
#!/bin/bash
# redis Startup script for the redis management
# this script create it by toice 2012.09.13
# it is Version:redis-2.4.17
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
# my mail address is toice dot 163.com
# description: redis is a key/value based in memory database.
# processname: redis
# redis pidfile: /usr/local/webserver/redis/run/redis.pid
# redis config: /usr/local/webserver/redis/conf/redis.conf
REDIS_BIN=/root/redis-2.6.14/src/redis-server
REDIS_CONF=/root/redis-2.6.14/redis.conf
REDIS_PID=/var/run/redis.pid
RETVAL=0
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $REDIS_BIN ] || exit 0
ulimit -HSn 65535
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
try=`expr $try + 1`
sleep 1
done
}
redis_start() {
if [ -e $REDIS_PID -a ! -z $REDIS_PID ];then
echo "redis already running...."
exit 1
fi
echo -n "Starting redis: "
$REDIS_BIN $REDIS_CONF && success || failure
wait_for_pid created $REDIS_PID
if [ -n "$try" ] ; then
RETVAL=1
else
RETVAL=0
fi
return $RETVAL
}
redis_stop() {
echo -n "Stopping redis: "
if [ ! -r $REDIS_PID ] ; then
echo "warning, no pid file found - redis is not running ?"
exit 1
fi
kill -TERM `cat $REDIS_PID`
wait_for_pid removed $REDIS_PID
if [ -n "$try" ] ; then
RETVAL=1
failure
else
RETVAL=0
success
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
redis_start
;;
stop)
redis_stop
;;
restart)
redis_stop
redis_start
;;
*)
echo $"Usage: redis{start|stop|restart}"
exit 1
esac
exit $RETVAL
# redis Startup script for the redis management
# this script create it by toice 2012.09.13
# it is Version:redis-2.4.17
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
# my mail address is toice dot 163.com
# description: redis is a key/value based in memory database.
# processname: redis
# redis pidfile: /usr/local/webserver/redis/run/redis.pid
# redis config: /usr/local/webserver/redis/conf/redis.conf
REDIS_BIN=/root/redis-2.6.14/src/redis-server
REDIS_CONF=/root/redis-2.6.14/redis.conf
REDIS_PID=/var/run/redis.pid
RETVAL=0
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $REDIS_BIN ] || exit 0
ulimit -HSn 65535
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
try=`expr $try + 1`
sleep 1
done
}
redis_start() {
if [ -e $REDIS_PID -a ! -z $REDIS_PID ];then
echo "redis already running...."
exit 1
fi
echo -n "Starting redis: "
$REDIS_BIN $REDIS_CONF && success || failure
wait_for_pid created $REDIS_PID
if [ -n "$try" ] ; then
RETVAL=1
else
RETVAL=0
fi
return $RETVAL
}
redis_stop() {
echo -n "Stopping redis: "
if [ ! -r $REDIS_PID ] ; then
echo "warning, no pid file found - redis is not running ?"
exit 1
fi
kill -TERM `cat $REDIS_PID`
wait_for_pid removed $REDIS_PID
if [ -n "$try" ] ; then
RETVAL=1
failure
else
RETVAL=0
success
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
redis_start
;;
stop)
redis_stop
;;
restart)
redis_stop
redis_start
;;
*)
echo $"Usage: redis{start|stop|restart}"
exit 1
esac
exit $RETVAL
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30129545/viewspace-1467189/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- redis多例項重啟指令碼薦Redis指令碼
- windows通過python指令碼重啟本地redisWindowsPython指令碼Redis
- nginx重啟指令碼Nginx指令碼
- Nginx 重啟指令碼Nginx指令碼
- MacOS 啟動 -- Redis指令碼MacRedis指令碼
- redis 帶密碼重啟Redis密碼
- 分享一份nginx重啟指令碼Nginx指令碼
- 分享一例指令碼發版和tomcat重啟指令碼指令碼Tomcat
- IIS8應用池重啟指令碼指令碼
- Redis - Lua 指令碼Redis指令碼
- Redis的指令碼Redis指令碼
- Windows監控並重啟某個程式指令碼Windows指令碼
- Redis使用Lua指令碼Redis指令碼
- iOS逆向 Shell指令碼+指令碼重簽名iOS指令碼
- 定時重啟tomcat指令碼導致的亂碼問題Tomcat指令碼
- linux系統下重啟tomcat的shell指令碼LinuxTomcat指令碼
- 使用指令碼重簽名指令碼
- 重建重定位表指令碼指令碼
- Tomcat自動檢測和重啟指令碼(Linux)薦Tomcat指令碼Linux
- Redis Lua指令碼完全入門Redis指令碼
- httpd啟動指令碼httpd指令碼
- redis學習(九) redis事務和redis指令碼的比較Redis指令碼
- redis命令之-script指令碼學習Redis指令碼
- Tomcat啟動指令碼Tomcat指令碼
- SQL Server啟動指令碼SQLServer指令碼
- ORACLE的啟動指令碼Oracle指令碼
- 防止指令碼重複執行方法指令碼
- 【SHELL】Linux系統 Oracle例項監控、重啟 簡易Shell指令碼LinuxOracle指令碼
- Redis 實戰 —— 14. Redis 的 Lua 指令碼程式設計Redis指令碼程式設計
- 通過 Redis 定時執行指令碼Redis指令碼
- Redis大key掃描Python指令碼RedisPython指令碼
- redis的bigkey掃描指令碼Redis指令碼
- redis中lua指令碼的簡單使用Redis指令碼
- redis3.0叢集監控指令碼RedisS3指令碼
- redis+lua指令碼實現介面限流Redis指令碼
- Slackware啟動指令碼與System V啟動指令碼的區別何在?(轉)指令碼
- linux-啟動指令碼Linux指令碼
- Linux自啟動指令碼Linux指令碼