6 Replies Latest reply on Dec 1, 2014 5:25 PM by CMata_Intel

    How to start Node.js app on Start Up?

    BoraTuran

      Hi,  I am trying to start a node.js app on startup. I have created the  following system service file (alvin5StartUp.service) and put it at /lib/systemd/system.

       

      I am getting an error with the following ExecStart line, am I doing something wrong?

      ExecStart=/usr/bin node /node_app_slot/main.js




      Details

      ------------------------------------------------------------

       

      root@Alvin5Edison:~# cat  /lib/systemd/system/alvin5StartUp.service

      [Unit]

      Description=alvin5Startup

      After=network.target

       

      [Service]

      ExecStart=/usr/bin node /node_app_slot/main.js

      Restart=always

      RestartSec=1s

      Environment=NODE_ENV=production

       

      [Install]

      WantedBy=multi-user.target

      root@Alvin5Edison:~#

      root@Alvin5Edison:~# systemctl daemon-reload

      root@Alvin5Edison:~# systemctl start  alvin5StartUp -l

      root@Alvin5Edison:~# systemctl status alvin5StartUp -l

      alvin5StartUp.service - alvin5Startup

         Loaded: loaded (/lib/systemd/system/alvin5StartUp.service; enabled)

         Active: failed (Result: start-limit) since Tue 2014-11-11 08:02:03 UTC; 641ms ago

        Process: 479 ExecStart=/usr/bin node /node_app_slot/main.js (code=exited, status=203/EXEC)

      Main PID: 479 (code=exited, status=203/EXEC)

       

      Nov 11 08:02:03 Alvin5Edison systemd[1]: alvin5StartUp.service holdoff time over, scheduling restart.

      Nov 11 08:02:03 Alvin5Edison systemd[1]: Stopping alvin5Startup...

      Nov 11 08:02:03 Alvin5Edison systemd[1]: Starting alvin5Startup...

      Nov 11 08:02:03 Alvin5Edison systemd[1]: alvin5StartUp.service start request repeated too quickly, refusing to start.

      Nov 11 08:02:03 Alvin5Edison systemd[1]: Failed to start alvin5Startup.

      Nov 11 08:02:03 Alvin5Edison systemd[1]: Unit alvin5StartUp.service entered failed state.

      root@Alvin5Edison:~#