Skip to content

Commit

Permalink
FIX: added FOREVER_ROOT variable
Browse files Browse the repository at this point in the history
  • Loading branch information
srossross authored and indexzero committed Mar 26, 2014
1 parent b873164 commit 5e15626
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ forever.out = new (winston.Logger)({
forever.initialized = false;
forever.kill = require('forever-monitor').kill;
forever.checkProcess = require('forever-monitor').checkProcess;
forever.root = path.join(process.env.HOME || process.env.USERPROFILE || '/root', '.forever');
forever.root = process.env.FOREVER_ROOT || path.join(process.env.HOME || process.env.USERPROFILE || '/root', '.forever');
forever.config = new nconf.File({ file: path.join(forever.root, 'config.json') });
forever.Forever = forever.Monitor = require('forever-monitor').Monitor;
forever.Worker = require('./forever/worker').Worker;
Expand Down

2 comments on commit 5e15626

@olombart
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, thanks! Could we have it on NPM as well? (e.g. version 0.10.12?)

@amayem
Copy link

@amayem amayem commented on 5e15626 Apr 3, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working but when I use it with ghost it runs it but then tells me that there are no forever processes running with list. Even though the blog is up. It wasn't doing this before. Here are the commands after a reboot.

[root]# cd /var/www/ghost/
[root]#  su ghost
bash-4.1$ forever stopall
info:    No forever processes running
bash-4.1$ ls forever/
1dRX.log  5cBT.log  an4G.log  ausF.log  config.json  _gAJ.log  Kr2j.log  pids  P-yh.log  sock  wD5V.log  xcH9.log
bash-4.1$ FOREVER_ROOT=/var/www/ghost/forever forever cleanlogs
bash-4.1$ ls forever/
config.json  pids  sock
bash-4.1$ FOREVER_ROOT=/var/www/ghost/forever forever start index.js 
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: index.js
bash-4.1$ forever list
info:    No forever processes running
bash-4.1$ ls forever
config.json  H9av.log  pids  sock
bash-4.1$ cat forever/H9av.log 
Ghost is running in development... 
Listening on 192.241.121.253:2368 
Url configured as: http://my-ghost-blog.com 
Ctrl+C to shut down
bash-4.1$ ps aux | grep ghost
root       607  0.0  0.0 141324  1572 pts/0    S    10:30   0:00 su ghost
ghost      608  0.0  0.0 108304  1820 pts/0    S    10:30   0:00 bash
ghost      632  0.0  1.2 719744 26132 ?        Ssl  10:32   0:00 /usr/bin/node /usr/lib/node_modules/forever/bin/monitor index.js
ghost      634  0.0  2.8 1045096 60676 ?       Sl   10:32   0:00 /usr/bin/node /var/www/ghost/index.js
ghost      679  0.0  1.2 719744 26228 ?        Ssl  10:36   0:00 /usr/bin/node /usr/lib/node_modules/forever/bin/monitor index.js
ghost      706  0.0  0.0 110236  1168 pts/0    R+   10:52   0:00 ps aux
ghost      707  0.0  0.0 103248   852 pts/0    S+   10:52   0:00 grep ghost

bash-4.1$ FOREVER_ROOT=/var/www/ghost/forever forever start index.js 
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: index.js
bash-4.1$ forever list
info:    No forever processes running
bash-4.1$ ls forever/
config.json  H9av.log  HxcC.log  pids  sock
bash-4.1$ cat forever/HxcC.log 

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at net.js:1146:9
    at dns.js:72:18
    at process._tickDomainCallback (node.js:459:13)
    at process._tickFromSpinner (node.js:390:15)
error: Forever detected script exited with code: 8

Please sign in to comment.