node.jsshellfreebsdrcjail

Making an npm script auto start in a FreeBSD Jail


I've installed an npm package / script in a JAIL on FreeNAS 9.10. (FreeBSD based) It works perfectly if I run "npm start" in the directory where the scripts are installed.

However, I need this to be auto-starting when the jail starts. I don't know now to do that. Do I need to create an rc script?

Basically all I need to do is give the "npm start" in the correct directory on start up. How do I do that?

thanks


Solution

  • Yes, you can place an rc script within the jail and enable it using the jail's /etc/rc.conf file.

    But, for a quick and dirty solution, you could create a /etc/rc.local script (also within the jail's environment) and put your startup commands in there.

    See the manual page here.