initd-forever

Create a daemon of a nodejs application

INITD-FOREVER

initd-forever is a node.js module to create a daemon for your nodejs application.

The package generates a shell script for /etc/init.d using forever package.

It generates also a shell script for monitoring daemon with the debain package monit

You can install initd-forever and its dependencies with npm:

npm install initd-forever -g for a global installation (for example)

To generate daemon and monit files from the command line, use following options:

    $ initd-forever --help
    usage: initd-forever [options]

    Generate the script file as a daemon and the monit script file.

    options:
        -a, --app           APP         Path to node.js main js file
        -c, --command   COMMAND Command to execute on the nodejs file used for custom command line options
        -e, --env           ENV         Export NODE_ENV with ENV value
        -l, --logfile       LOGFILE     Logs the daemon output to LOGFILE
        -n, --name          NAME        Application name
        -p, --pidfile       PIDFILE     The pid file
        -m, --monit         MONITPORT   Generate the monit script file with the port number MONITPORT where your application runs
        -f, --forever   FOREVER Path to forever script
    Error:
    Cannot generate daemon file: no options defined and package.json is not found.

For missing options, initd-forever will use values saved in the package.json.

Default is the main defined in package.json

Default is production

Default is the name defined in package.json

Default is based on name value: /var/run/name.log

Default is based on name value: /var/run/name.pid

Default doesn't generate the monit script file.

Default uses whatever script the enviroment variable points to

Default passes the nodejs executable '/usr/bin/env node'

To run the tests under node you will need mocha and should installed (it's listed as a devDependencies so npm install from the checkout should be enough), then do

$ npm test

initd-forever is currently maintained by Yassine Azzout.

MIT license