Run script with rc.local: script works, but not at boot

前端 未结 16 1191
失恋的感觉
失恋的感觉 2020-12-02 07:38

I have a node.js script which need to start at boot and run under the www-data user. During development I always started the script with:

su www-dat         


        
16条回答
  •  -上瘾入骨i
    2020-12-02 07:54

    I got my script to work by editing /etc/rc.local then issuing the following 3 commands.

    sudo mv /filename /etc/init.d/
    sudo chmod +x /etc/init.d/filename 
    sudo update-rc.d filename defaults
    

    Now the script works at boot.

提交回复
热议问题