centos redis自启动
#!/bin/sh
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem. REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid
#CONF="/etc/redis/${REDISPORT}.conf"
CONF="/home/bag/redis-3.2.1/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
其实这个文件,在redis安装目录的utils目录也有,不要在前面加上
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
即可。
设置开机启动
复制该文件到/etc/init.d/redis
然后设置开机启动命令
sudo chkconfig redis on
centos redis自启动的更多相关文章
- centOS 开机自启动自己的脚本
centOS 开机自启动自己的脚本 1. 自己脚本 myservice 如下: #!/bin/bash # chkconfig: # description: myservice .... echo ...
- Centos开机自启动脚本的制作
原文地址:http://www.2cto.com/os/201306/220559.html 我的一个Centos开机自启动脚本的制作 一.切换到/etc/init.d/ 二.制作sh脚本 v ...
- redis自启动配置详解
一.概述 1.1原理 redis自启动的工作原理是怎么样的呢?Linux系统启动后,会有一个程序去特定目录下面扫描文件,然后执行这些文件,这些文件可称之为脚本.所以,你可以把你的工作写成一个脚本,放到 ...
- centos 安装redis自启动要点
1.redis.conf a.daemonize yes b.pidfile /var/run/xxx.pid 2./etc/init.d/redis //加了下面三个注释部分,才支持设置开机自启动 ...
- Centos开机自启动redis
修改redis.conf,打开后台运行选项: # By default Redis does not run as a daemon. Use 'yes' if you need it. # Note ...
- CentOS 配置自启动Redis
第一步: 在/etc/init.d/目录下建立一个名字为 redis 的启动脚本 cd /etc/init.d touch redis 然后在这个脚本中添加如下脚本 <注意修改自己的PIDFI ...
- CentOS开机自启动
CentOS 配置的开机自启动. vim /etc/rc.local #!/bin/sh # # This script will be executed *after* all the other ...
- centos redis 3.2.11 安装与配置
centos 7 下载解压 wget http://download.redis.io/releases/redis-3.2.11.tar.gz tar xzf redis-3.2.11.tar.gz ...
- Centos 开机自启动一些软件配置
CentOS设置服务开机启动的方法 CentOS设置服务开机启动的两种方法 1.利用 chkconfig 来配置启动级别 在CentOS或者RedHat其他系统下,如果是后面安装的服务,如http ...
随机推荐
- npm publish 发布失败 无法连接 https://registry.npmjs.org
自己写的npm包,之前每次更新都是正常发布,最近做个一个更新,想发布,然后npm publish 竟然失败, 错误提示如下: npm ERR! network request to https://r ...
- python 连接 hive
1.python连接hive,其实是连接hiveserver,连接的包的impyla impyla安装: error: cc1plus 没有文件或目录 需要安装gcc 和g++,并且版本保持一致 er ...
- const成员变量
#include <iostream> using namespace std; class A { public: A(int size) : SIZE(size) {}; privat ...
- 拷贝docker镜像到其他机器部署
有拷贝docker images到其他主机的情况,当然是通过pull的方式来转移到其他宿主机. 1 sudo docker save -o golang:alpine3.7 ./my-golang- ...
- vue的特点 关键字
1.对mvvm模式的理解 Model-view-viewmodel Model数据模型 View代表ui组件 Viewmodel监听模型数据的改变和控制视图行为.处理用户交互,简单理解就是一个同步vi ...
- 【React】- 1、React介绍
React的开发背景 构建数据不断变化的大型应用 大量DOM操作 <---- 自动DOM操作 数据变化 逻辑及其复杂 <---- 状态对应内容(自动变化) 特点: - 简单 ...
- 【OpenCV】轮廓的特征矩Moment
opencv中的矩主要包括以下几种:空间矩,中心矩和中心归一化矩. class Moments { public: ...... // 空间矩 double m00, m10, m01, m20, m ...
- 【机器学习】QQ-plot深入理解与实现
QQ-plot深入理解与实现 26JUN June 26, 2013 最近在看关于CSI(Channel State Information)相关的论文,发现论文中用到了QQ-plot.Sigh!我承 ...
- java_guide_9-30_并发相关
3.1 CopyOnWriteArrayList 简介 public class CopyOnWriteArrayList<E> extends Object implements Lis ...
- Error:[$injector:modulerr]错误解决方式
1.报错信息如下图所示: 问题:目前应用打包之后,在iphone6手机上打开应用白板(打开vconsole发现有如上报错 >>> 测试过多部手机,仅上面的IOS9版本出现问题) ...