Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- changed the --pidfile to --pidFile
- changed the awk line to use the default column numbers for forever list output
- fixed the inability to execute the script from outside the source directory
by referencing and implementing the suggestions in this issue: foreversd#229
  • Loading branch information
Michael Dillon committed Feb 17, 2012
1 parent b093bfc commit 7c03609
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/initd-example
Expand Up @@ -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 --sourceDir $INSTANCE_DIR $SOURCE_NAME
RETVAL=$?
else
echo "Instance already running"
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/forever/cli.js
Expand Up @@ -189,6 +189,7 @@ var getOptions = cli.getOptions = function (file) {

app.config.use('argv', { argv: argvOptions });

options.sourceDir = file && file[0] !== '/' ? process.cwd() : '/';
[
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'appendLog',
'silent', 'outFile', 'max', 'command', 'path', 'spinSleepTime',
Expand All @@ -197,7 +198,6 @@ var getOptions = cli.getOptions = function (file) {
options[key] = app.config.get(key);
});

options.sourceDir = file && file[0] !== '/' ? process.cwd() : '/';
if (options.sourceDir) {
options.spawnWith = {cwd: options.sourceDir};
}
Expand Down

0 comments on commit 7c03609

Please sign in to comment.