Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: foreverjs/forever
base: 2f93ba447e
...
head fork: foreverjs/forever
compare: 0b80e4dfd5
  • 6 commits
  • 6 files changed
  • 0 commit comments
  • 3 contributors
View
1  README.md
@@ -130,7 +130,6 @@ There are several options that you should be aware of when using forever. Most o
// Basic configuration options
//
'silent': false, // Silences the output from stdout and stderr in the parent process
- 'forever': true, // Indicates that this script should run forever
'uid': 'your-UID' // Custom uid for this forever process. (default: autogen)
'pidFile': 'path/to/a.pid', // Path to put pid information for the process(es) started
'max': 10, // Sets the maximum number of times a given script should run
View
4 examples/initd-example
@@ -40,7 +40,7 @@ start() {
# Launch the application
start_daemon
- $forever start -p $forever_dir --pidfile $pidfile -l $logfile -a -d $INSTANCE_DIR $SOURCE_NAME
+ $forever start -p $forever_dir --pidFile $pidfile -l $logfile -a -d $INSTANCE_DIR $SOURCE_NAME
RETVAL=$?
else
echo "Instance already running"
@@ -70,7 +70,7 @@ stop() {
getForeverId() {
local pid=$(pidofproc -p $pidfile)
- $forever list -p $forever_dir | $sed -e 's/\x1b\[[0-9; ]*m//g' | $awk "\$4 == \"$pid]\" { gsub(/[\[\]]/, \"\", \$1); print \$1; }"
+ $forever list -p $forever_dir | $sed -e 's/\x1b\[[0-9; ]*m//g' | $awk "\$6 && \$6 == \"$pid\" { gsub(/[\[\]]/, \"\", \$2); print \$2; }";
}
id=$(getForeverId)
View
17 lib/forever.js
@@ -180,7 +180,8 @@ function stopOrRestart(action, event, format, target) {
if (target) {
procs = forever.findByIndex(target, processes)
- || forever.findByScript(target, processes);
+ || forever.findByScript(target, processes)
+ || forever.findByUid(target, processes);
}
if (procs && procs.length > 0) {
@@ -556,6 +557,20 @@ forever.findByScript = function (script, processes) {
};
//
+// ### function findByUid (uid, processes)
+// #### @uid {string} The uid of the process to find.
+// #### @processes {Array} Set of processes to find in.
+// Finds the process with the specified uid.
+//
+forever.findByScript = function (script, processes) {
+ return !processes
+ ? null
+ : processes.filter(function (p) {
+ return p.uid === script;
+ });
+};
+
+//
// ### function format (format, procs)
// #### @format {Boolean} Value indicating if processes should be formatted
// #### @procs {Array} Processes to format
View
4 lib/forever/cli.js
@@ -45,7 +45,7 @@ var help = [
' -p PATH Base path for all forever related files (pid files, etc.)',
' -c COMMAND COMMAND to execute (defaults to node)',
' -a, --append Append logs',
- ' --pidfile The pid file',
+ ' --pidFile The pid file',
' --sourceDir The source directory for which SCRIPT is relative to',
' --minUptime Minimum uptime (millis) for a script to not be considered "spinning"',
' --spinSleepTime Time to wait (millis) between launches of a spinning script.',
@@ -195,7 +195,7 @@ var getOptions = cli.getOptions = function (file) {
options[key] = app.config.get(key);
});
- options.sourceDir = file && file[0] !== '/' ? process.cwd() : '/';
+ options.sourceDir = options.sourceDir || (file && file[0] !== '/' ? process.cwd() : '/');
if (options.sourceDir) {
options.spawnWith = {cwd: options.sourceDir};
}
View
3  lib/forever/monitor.js
@@ -219,6 +219,9 @@ Monitor.prototype.trySpawn = function () {
this.spawnWith.command = this.command;
if (this.forkShim) {
+ if (typeof this.forkShim === 'string') {
+ this.spawnWith.forkModule = this.forkShim;
+ }
this.spawnWith.env['FORK_SHIM'] = true;
return nodeFork.shim.fork(this.args[0], this.args.slice(1), this.spawnWith);
}
View
2  test/core/check-process-test.js
@@ -15,7 +15,7 @@ var assert = require('assert'),
vows.describe('forever/core/check-process').addBatch({
"When using forever": {
"checking if process exists": {
- "if process process exists": {
+ "if process exists": {
topic: forever.checkProcess(process.pid),
"should return true": function (result) {
assert.isTrue(result);

No commit comments for this range

Something went wrong with that request. Please try again.