#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
### BEGIN INIT INFO
# Provides: redis_6379
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Redis data structure server
# Description: Redis data structure server. See https://redis.io
### END INIT INFO
#pid=`ps -efl|grep redis|grep -v $0|grep -v grep|wc -l`
pid=`ps -ef|grep redis |grep 5378 |grep -v grep|awk '{print $2}' `
echo "redisd的pid:${pid}"
if [ $ps -eq 0 ];
then
echo -e "\n$(date '+%Y-%m-%d %H:%M:%S') start "
/usr/local/redis/redis-3.0.0/src/redis-server /usr/local/redis/redis-3.0.0/redis.conf
echo "$(date '+%Y-%m-%d %H:%M:%S') done"
else
echo $(date +%F%n%T) "redis正在关闭...pid=${pid}"
kill -9 $pid
echo $(date +%F%n%T) "redis正在关闭成功...pid=${pid}"
echo $(date +%F%n%T) "redis正在启动..."
/usr/local/redis/redis-3.0.0/src/redis-server /usr/local/redis/redis-3.0.0/redis.conf
echo $(date +%F%n%T) "redis正在启动成功..."
exit 0;
fi
网友评论