嘘~ 正在从服务器偷取页面 . . .

Centos 更换镜像源


Centos 自启动服务配置

1、Redis 服务自启动

在 /etc/init.d/ 目录新建文件

cd /etc/init.d/
vi redisd

文件内容:

#!/bin/sh
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database

EDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/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
  ;;
 stop)
  if [ ! -f $PIDFILE ]
  then
    echo "$PIDFILE does not exist, process is not running"
  else
    PID=$(cat $PIDFILE)
    echo "Stopping ..."
    $CLIEXEC -p $REDISPORT shutdown
    while [ -x /proc/${PID} ]
    do
     echo "Waiting for Redis to shutdown ..."
     sleep 1
    done
    echo "Redis stopped"
  fi
  ;;
 *)
  echo "Please use start or stop as first argument"
  ;;
esac

开启自启动

chkconfig redisd on

测试

reboot  # 重启
ps -ef | grep redisd

2、Mysql自启动



版权声明: 本博客所有文章除特別声明外,均采用 CC BY-SA 4.0 许可协议。转载请注明来源 Small-Rose / 张小菜 !
评论
  目录