centos7 开机自动执行脚本

1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权

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

2、赋予脚本可执行权限
假设/usr/local/script/autostart.sh是你的脚本路径,给予执行权限

chmod +x /usr/local/script/autostart.sh

3、打开/etc/rc.d/rc.local文件,在末尾增加如下内容

/usr/local/script/autostart.sh

 4.查看启动日志

/var/log/messages

 

  

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim /etc/sysconfig/network-scripts/ifcfg-eth0 B...