1.编写配置脚本 [** vim /etc/init.d/redis** ]
#!/bin/sh
# chkconfig: 2345 10 90
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REDISPORT=6379
EXEC=/usr/local/redis/redis-server #redis-server路径
CLIEXEC=/usr/local/redis/redis-cli #redis-cli路径
PIDFILE=/var/run/redis_${REDISPORT}.pid #redis_${REDISPORT}.pid路径
CONF="/usr/local/redis/redis.conf" #redis.conf路径
AUTH="School1502" #redis 密码
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
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
e
LINUX开机自启动redis服务
最新推荐文章于 2025-07-14 22:58:31 发布