tasks/forever-task.js
function startForeverWithIndex( index, doneCB ) {
  log( 'Attempting to start ' + index + ' as daemon.');

  var config;
  var appendConfig = function(prop, value) {
    log('Adding to config: ' + prop + ', ' + value);
    if(value !== undefined) {
      config[prop] = value;
    }
  };
  done = doneCB || this.async();
  findProcessWithIndex( index, function(process) {
    // if found, be on our way without failing.
    if( typeof process !== 'undefined' ) {
      warn( index + ' is already running.');
      log( forever.format(true, [process]) );
      done();
    }
    else {
      gruntRef.file.mkdir(logDir);
      // 'forever start -o out.log -e err.log -c node -a -m 3 index.js';
      config = {
        command: commandName,
        append: true,
        max: 3,
        killSignal: killSignal
      };
      appendConfig('errFile', errFile);
      appendConfig('outFile', outFile);
      appendConfig('logFile', logFile);
      forever.startDaemon( index, config );
      log( 'Logs can be found at ' + logDir + '.' );
      done();
    }
  });
}
function startForeverWithIndex( index, doneCB ) {
  log( 'Attempting to start ' + index + ' as daemon.');

  var config;
  var appendConfig = function(prop, value) {
    log('Adding to config: ' + prop + ', ' + value);
    if(value !== undefined) {
      config[prop] = value;
    }
  };
  done = doneCB || this.async();
  findProcessWithIndex( index, function(process) {
    // if found, be on our way without failing.
    if( typeof process !== 'undefined' ) {
      warn( index + ' is already running.');
      log( forever.format(true, [process]) );
      done();
    }
    else {
      gruntRef.file.mkdir(logDir);
      // 'forever start -o out.log -e err.log -c node -a -m 3 index.js';
      config = {
        command: commandName,
        append: true,
        max: 3,
        killSignal: killSignal
      };
      appendConfig('errFile', errFile);
      appendConfig('outFile', outFile);
      appendConfig('logFile', logFile);
      forever.startDaemon( index, config );
      log( 'Logs can be found at ' + logDir + '.' );
      done();
    }
  });
}
function startForeverWithIndex ( index , doneCB ) { log ( 'Attempting to start ' + index + ' as daemon.' ) ; var config ; var appendConfig = function ( prop , value ) { log ( 'Adding to config: ' + prop + ', ' + value ) ; if ( value !== undefined ) { config [ prop ] = value ; } } ; done = doneCB || this . async ( ) ; findProcessWithIndex ( index , function ( process ) { // if found, be on our way without failing. if ( typeof process !== 'undefined' ) { warn ( index + ' is already running.' ) ; log ( forever . format ( true , [ process ] ) ) ; done ( ) ; } else { gruntRef . file . mkdir ( logDir ) ; // 'forever start -o out.log -e err.log -c node -a -m 3 index.js'; config = { command : commandName , append : true , max : 3 , killSignal : killSignal } ; appendConfig ( 'errFile' , errFile ) ; appendConfig ( 'outFile' , outFile ) ; appendConfig ( 'logFile' , logFile ) ; forever . startDaemon ( index , config ) ; log ( 'Logs can be found at ' + logDir + '.' ) ; done ( ) ; } } ) ; }
Attempts to start process using the index file.
@param  {String} index Filename.
Attempts to start process using the index file .