linux开机自启

ubuntu
1、在 /etc/init.d 目录下新建脚本
touch text.sh
#! /bin/sh
touch /home/data/datashell/haha.php
2、赋予执行权限
sudo chmod 755 test.sh
sudo update-rc.d test.sh default 99

centos
1、在 /etc/init.d 目录下新建脚本
touch text.sh
#! /bin/sh
touch /home/data/datashell/haha.php
2、赋予执行权限
sudo chmod 755 test.sh
在/etc/rc.d/rc.local 默认添加 /etc/rc.d/init.d/test.sh
给rc.local执行权限
chmod +x rc.loal

reboot 重启

猜你喜欢

转载自blog.csdn.net/weixin_40974880/article/details/84262208