十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
# chkconfig: 2345 90 10
成都创新互联公司主营呼兰网站建设的网络公司,主营网站建设方案,成都app开发,呼兰h5重庆小程序开发搭建,呼兰网站营销推广欢迎呼兰等地区企业咨询
# description: redis is a persistent key-value database
PATH=$PATH:/usr/local/redis/bin:/sbin:/usr/bin:/bin
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
REDIS_CLI=/usr/local/redis/bin/redis-cli
PASS=chbin123
PIDFILE=/var/run/redis_6379.pid
CONF="/usr/local/redis/etc/redis.conf"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="0" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$REDIS_CLI -a $PASS -p $REDISPORT SHUTDOWN
while [ -x ${PIDFILE} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2
exit 1
esac
-----------------------------
添加redis服务开机启动:
chmod +x /etc/init.d/redis
启动redis服务:
service redis start
检查服务是否启动
ps -ef | grep redis
netstat -anptu | grep 6379