diff --git a/bin/forever b/bin/forever index 0fac847d..41b9a48c 100755 --- a/bin/forever +++ b/bin/forever @@ -13,7 +13,7 @@ if (accepts.indexOf(process.argv[2]) !== -1) { var argv = require('optimist').argv; require.paths.unshift(path.join(__dirname, '..', 'lib')); -var forever = require('../lib/forever'); +var forever = require('forever'); var help = [ "usage: forever [start | stop | restart | stopall | list | cleanlogs] [options] SCRIPT [script options]", @@ -26,18 +26,18 @@ var help = [ " list list all running forever scripts", " cleanlogs [CAREFUL] Deletes all historical forever log files", "", - " -m MAX Only run the specified script MAX times", - " -l LOGFILE Logs the forever output to LOGFILE", - " -a, --append Append logs", - " -o OUTFILE Logs stdout from child script to OUTFILE", - " -e ERRFILE Logs stderr from child script to ERRFILE", - " -d SOURCEDIR The source directory for which SCRIPT is relative to", - " -p PATH Base path for all forever related filesĀ (pid files, etc.)", - " -c COMMAND COMMAND to execute (defaults to node)", - " --pidfile=PIDFILE The pid file", - " -v, --verbose Turns on the verbose messages from Forever", - " -s, --silent Run the child script silencing stdout and stderr", - " -h, --help You're staring at it", + " -m MAX Only run the specified script MAX times", + " -l LOGFILE Logs the forever output to LOGFILE", + " -a, --append Append logs", + " -o OUTFILE Logs stdout from child script to OUTFILE", + " -e ERRFILE Logs stderr from child script to ERRFILE", + " -d SOURCEDIR The source directory for which SCRIPT is relative to", + " -p PATH Base path for all forever related filesĀ (pid files, etc.)", + " -c COMMAND COMMAND to execute (defaults to node)", + " --pidfile The pid file", + " -v, --verbose Turns on the verbose messages from Forever", + " -s, --silent Run the child script silencing stdout and stderr", + " -h, --help You're staring at it", "", "[Long Running Process]", " The forever process will continue to run outputting log messages to the console.", diff --git a/lib/forever.js b/lib/forever.js index 8becc7ea..8e55c436 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -50,7 +50,7 @@ forever.load = function (options) { return; } - forever.config = config = options; + forever.config = config = options; // // Syncronously create the `root` directory @@ -85,6 +85,7 @@ forever.load(); forever.stat = function (logFile, script, callback) { var logAppend, realCallback = callback; + if (arguments.length === 4) { logAppend = callback; realCallback = arguments[3]; @@ -427,7 +428,7 @@ forever.pidFilePath = function(pidFile) { if (pidFile && pidFile[0] === "/") { return pidFile; } else { - return path.join(config.pidPath, pidFile); + return path.join(forever.config.pidPath, pidFile); } };