应付已测试成功的方法 一:
1.将脚本移动到/etc/rc.d/init.d目录下
mv /opt/script/autostart.sh/etc/rc.d/init.d
复制或剪切文件到/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
注意如果报错
service xxxx does not support chkconfig
在脚本开头出添加如下语句。服务不支持 chkconfig另外还有一个非常重要的原因
就是可执行权限。
#chkconfig: - 85 15
#description: nginx is a World Wide Web server. It is used to serve