Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.77 KB

README.md

File metadata and controls

55 lines (39 loc) · 1.77 KB

Synopsis

A simple Unix shell script example to start, stop, restart, and check status of NodeJS forever tool that ensures that a given script runs continuously.

Installation

You would need to install forever tool globally:

  $ [sudo] npm install forever -g

Place the script into init.d directory.

Update reference according to your system and project setup:

Variables


NAME="myapp"                                Application name
APP_DIRECTORY=/var/www/html/myapp.com       Application directory path to start file
APP_START=server.js                         Application start file name

Setup executable permissions:

chmod +x /etc/init.d/foreverdaemon

Add script to boot on Debian:

update-rc.d foreverdaemon defaults 100

Remove script from boot on Debian:

update-rc.d foreverdaemon stop levels .

Usage

To start the service:

  $ [sudo] /etc/init.d/foreverdaemon start

To stop the service:

  $ [sudo] /etc/init.d/foreverdaemon stop

To restart the service:

  $ [sudo] /etc/init.d/foreverdaemon restart

To get the status:

  $ [sudo] /etc/init.d/foreverdaemon status

License

License: MIT