MENU

宝塔lnmp环境开机运行

September 3, 2019 • 群晖相关

docker 中安装了宝塔Linux管理面板,并安装了LNMP环境,默认是不会随 docker 重启而自动启动的,需要手动添加开机运行。

0x01.脚本内容:

#!/bin/bash                                                                     
echo start mysql...
/etc/init.d/mysqld stop
/etc/init.d/mysqld start

echo start php-fpm-56...
/etc/init.d/php-fpm-56 stop
/etc/init.d/php-fpm-56 start

echo start nginx...
/etc/init.d/nginx stop
/etc/init.d/nginx start

echo start bt
/etc/init.d/bt stop
/etc/init.d/bt start

0x02. 给予脚本执行权限:

chmod +x ~/btstart.sh

0x03. 添加脚本路径到 /etc/rc.d/rc.local 文件中:

echo "~/btstart.sh" >> /etc/rc.d/rc.local

0x04. 给予 rc.local 执行权限

centos7 中,/etc/rc.d/rc.local 的权限被降低了(无执行权限),需要赋予其可执行权限:

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

0x05. 资料

宝塔linux面板命令大全
CentOS下添加开机运行脚本

Last Modified: September 22, 2019