Cetnos7 自启动设置汇总

版权声明:未经作者同意请勿转载,需要和博主联系请发邮件[email protected] https://blog.csdn.net/wu2700222/article/details/86539375

设置可执行权限,很重要,不然重启后rc.local的脚本不会执行

chmod +x /etc/rc.d/rc.local

 

1、kong和konga自启动

vim /root/scripts/kong.sh

#!/bin/bash
kong start
docker start konga

chmod +x /root/scripts/kong.sh

vim /etc/rc.local 添加一行/root/scripts/kong.sh

2、redis集群自启动

vim /root/scripts/redis-cluster-start.sh

#!/bin/bash
nohup /data/soft/redis-3.2.12/bin/redis-server /data/soft/redis-3.2.12/cluster-conf/6379/redis.conf >/dev/null 2>/root/scripts/redis-6379.log &
nohup /data/soft/redis-3.2.12/bin/redis-server /data/soft/redis-3.2.12/cluster-conf/6380/redis.conf >/dev/null 2>/root/scripts/redis-6380.log &
nohup /data/soft/redis-3.2.12/bin/redis-server /data/soft/redis-3.2.12/cluster-conf/6381/redis.conf >/dev/null 2>/root/scripts/redis-6381.log &

chmod +x /root/scripts/

vim /etc/rc.local 添加一行 /root/scripts/redis-cluster-start.sh

3、redis单机自启动

vim /root/scripts/redis.sh

#!/bin/bash
nohup /data/soft/redis-3.2.12/bin/redis-server /data/soft/redis-3.2.12/cluster-conf/6382/redis.conf >/dev/null 2>/root/scripts/redis-6382.log &

chmod +x /root/scripts/

vim /etc/rc.local 添加一行 /root/scripts/redis.sh

4、rrdb、consul 自启动

vim /root/scripts/rrdb.sh

#!/bin/bash
nohup /data/soft/rrdb/src/rrdb-server /data/soft/rrdb/rrdb.conf  >/dev/null 2>/root/scripts/rrdb.log &

vim /root/scripts/consul.sh 

#!/bin/bash
nohup /data/soft/consul_1.2.1/consul agent -server -bootstrap -ui -data-dir=/data/soft/consul_1.2.1/consul-data  -bind=172.22.14.132   -client=0.0.0.0  -node=172.22.14.132 >/dev/null 2>/root/scripts/consul.log &

chmod +x /root/scripts/rrdb.sh

chmod +x /root/scripts/consul.sh 

vim /etc/rc.local 添加两行

/root/scripts/rrdb.sh

/root/scripts/consul.sh 

5、openvpn自启动设置(因为openvpn已加入系统自启动,但nat重启后会失效需重新注册

vim /root/scripts/vpnstart.sh 

iptables -t nat -A POSTROUTING -s 172.22.0.0/24 -j MASQUERADE 

猜你喜欢

转载自blog.csdn.net/wu2700222/article/details/86539375