我在centos7设置开启启动脚本无法运行怎么办?
我是这样写的启动脚本
1、将新建脚本autostart.sh脚本并移动到/etc/rc.d/init.d目录下
#!/bin/sh #chkconfig:2345 80 90 #decription:autostart ls;mv /usr/local/script/autostart.sh /etc/rc.d/init.d
2、增加脚本的可执行权限
chmod +x /etc/rc.d/init.d/autostart.sh
3、添加脚本到开机自动启动项目中
cd /etc/rc.d/init.d
chkconfig --add autostart.sh
chkconfig autostart.sh on
结果就是开机运行不了脚本,求大神指教
网友回复
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
ok了,这样既好了
google账号如何更改地区与国家?
为啥我的安卓手机chatgpt app打开报错Something went wrong. You may be connected to a disallowed ISP. If you are us
c#如何修改windows的代理设置?
国内华为andriod安卓苹果ios手机如何使用chatgpt4o的app?
win10中怎么让bat批处理文件打开和关闭代理服务?
win10中怎么让bat批处理文件运行完成后不关闭窗口?
docker启动容器后如何挂载宿主文件并执行命令?
有没有lnmp的docker镜像?
何为超级以太网联盟(UEC)?
如何用go语言写一个加密的socks5代理通讯?