LinuxCommandLibrary

forever

Run Node.js scripts continuously in the background

TLDR

Start running a file forever (as a daemon)

$ forever [script]
copy

List running "forever" processes (along with IDs and other details of "forever" processes)
$ forever list
copy

Stop a running "forever" process
$ forever stop [ID|pid|script]
copy

SYNOPSIS

forever [options] script.js [script-options]

PARAMETERS

-m
    Sets the maximum number of times a script should be restarted.

-l
    Logs forever output to .

-o
    Logs stdout from child script to .

-e
    Logs stderr from child script to .

-p
    Sets the path to store pid files (default: $HOME/.forever).

-c
    Sets the command to execute (default: node).

-a
    Appends logs to existing log files.

-f
    Forces forever to run when the log file exists.

-n
    Sets the number of instances to run.

-w
    Watches the script for file changes.

-v
    Increases verbosity.

-h
    Displays help.

-V
    Displays the version of forever.

start