Want more timely Centmin Mod News Updates?
Become a Member

Sysadmin Startup init script or any other solution

Discussion in 'System Administration' started by pamamolf, May 1, 2017.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,086
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    2:20 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hello

    I have an addon that recommends to use "forever" to start the js script like:

    Code:
    forever start /path/to/file.js
    As if it crashes or stops running for whatever reason, forever will start it back up.

    I can run it without "forever" also using:

    Code:
    node /path/to/file.js
    Now i need some help to start up node when server is restarted (nodejs.sh does that already?) and for an automated way to start file.js using "forever" or "screen" maybe or none of them and just start it.

    Thank you

     
  2. pamamolf

    pamamolf Premium Member Premium Member

    4,086
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    2:20 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    I was thinking for scenario one that the node is already auto starting to use a cron job like:

    Code:
    @reboot /usr/bin/forever start /path/to/file.js
    or if the installation script nodejs.sh doesn't take care of startup after server reboot to use this one?

    Code:
    @reboot /usr/bin/forever start -c /usr/bin/node /path/to/file.js
    what do you think?