开机启动Node程序

# 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值