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

前端 未结 16 1270
失恋的感觉
失恋的感觉 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条回答
  •  忘掉有多难
    2020-12-02 07:41

    if you are using linux on cloud, then usually you don't have chance to touch the real hardware using your hands. so you don't see the configuration interface when booting for the first time, and of course cannot configure it. As a result, the firstboot service will always be in the way to rc.local. The solution is to disable firstboot by doing:

    sudo chkconfig firstboot off
    

    if you are not sure why your rc.local does not run, you can always check from /etc/rc.d/rc file because this file will always run and call other subsystems (e.g. rc.local).

提交回复
热议问题