网上很多方法都不可行,于是自己操作成功后写一个可行的开机启动脚本,可以启动各种内容,绝对有效
vi beyond.sh
2.输入以下内容:
注意:前两行是固定的不用修改
第三行开始为自定义的服务启动脚本,请勿原班照抄
#!/bin/bash
#chkconfig: 2345 20 80
/usr/nginx/sbin/nginx -c /usr/nginx/conf/nginx.conf
/usr/redis/redis-3.0.0/bin/redis-server /usr/redis/redis-3.0.0/redis.conf
/usr/mongodb/mongodb-linux-x86_-4.0.4/bin/mongod --config /usr/mongodb/mongodb-linux-x86_-4.0.4/bin/mongodb.conf
/usr/zookeeper/zookeeper-3.4.5/bin/zkServer.sh start
/usr/local/tomcat/bin/startup.sh
systemctl start docker.service
docker exec -it 416e4e4c4d1d5a5a6384d04c12103a918783ef12733e1745067fce3ee71835 bash
3.保存完脚本后,使用chmod设置可执行权限:
chmod +x beyond.sh
cp beyond.sh /etc/init.d/
cd /etc/init.d/
6.将beyond.sh添加到系统服务:
chkconfig --add beyond.sh
7.设置开机启动:
chkconfig beyond.sh on
8.然后重启linux:
reboot
9.重启之后连接查看效果:rds换成自己的服务
ps -ef | grep rds
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- ovod.cn 版权所有 湘ICP备2023023988号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务