Skip to content

Commit

Permalink
[fix] service process listing
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeck authored and indexzero committed Oct 9, 2011
1 parent 1bfdcdb commit f2026b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions init.d/forever-services
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ node=node
forever=`which forever`
awk=awk
sed=sed
echo `env`

start() {
echo "Starting $NAME node instance: "
Expand All @@ -36,7 +35,7 @@ start() {
chown $USER $pidfile

# Launch the application
start_daemon -p $pidfile $forever service-start -p $forever_dir
start_daemon -p $pidfile -- $forever service-start -p $forever_dir
else
echo "Instance already running"
fi
Expand Down
10 changes: 8 additions & 2 deletions lib/forever/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,20 @@ cli['service-start'] = function (file, options) {
forever.log.info('No services found.');
return;
}
serviceFiles.forEach(function (serviceFile) {
var monitors = [];
serviceFiles.forEach(function (serviceFile, index) {
var serviceFilePath = path.join(forever.config.get('root'), 'services', serviceFile);
var service = JSON.parse(fs.readFileSync(serviceFilePath));
var file = service.file;
forever.log.info('Starting service for ' + file);
var options = service.options;
options.minUptime = 200;
cli.start(file, options, false);
var monitor = new forever.Monitor(file, options);
monitor.start();
monitors.push(monitor);
if(index === serviceFiles.length - 1) {
forever.startServer.apply(forever, monitors);
}
});
}
cli['service-stop'] = function (file, options) {
Expand Down

0 comments on commit f2026b3

Please sign in to comment.