# sudo vim /etc/init.d/test
1 #!/bin/bash
2
3 export PATH=$Path:/usr/local/bin
4
5 cd /home/workspace/webavod/
6 node app.js
第3行node目录, 第6行node程序目录,第7行执行程序.
# sudo chmod 777 /etc/init.d/test
# sudo update-rc.d test defaults 99
输出如下信息
update-rc.d: warning: /etc/init.d/test missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/test ...
/etc/rc0.d/K95test -> ../init.d/test
/etc/rc1.d/K95test -> ../init.d/test
/etc/rc6.d/K95test -> ../init.d/test
/etc/rc2.d/S95test -> ../init.d/test
/etc/rc3.d/S95test -> ../init.d/test
/etc/rc4.d/S95test -> ../init.d/test
/etc/rc5.d/S95test -> ../init.d/test
然后重启就可以了.
如果想移除用 # sudo update-rc.d -f test remove
参考:
http://blog.csdn.net/hcx25909/article/details/9068497
http://www.2cto.com/os/201407/315273.html