lib/actions.js
function (callback) {
    var cozyLight = require('./cozy-light');
    if (cozyLight.getStatus() === 'started') {
      cozyLight.setStopped();
      logger.info('Stopping apps...');
      return applicationHelpers.stopAll(function (appErr) {
        if (appErr) {
          logger.error('An error occurred while stopping applications');
          logger.raw(appErr);
        }

        logger.info('Stopping plugins...');
        pluginHelpers.stopAll(function (pluginErr) {
          if (pluginErr) {
            logger.error('An error occurred while stopping plugins');
            logger.raw(pluginErr);
          }

          logger.info('Stopping server...');
          var timeout = nodeHelpers.throwTimeout(
              'main server is too slow to stop...', 5000);

          mainAppHelper.stop(function(){
            clearTimeout(timeout);
            logger.info('\t' + symbols.ok + '\tmain server');
            nodeHelpers.invoke(callback);
          });
        });
      });
    }
    logger.debug('Apps already stopped');
    return nodeHelpers.invoke(callback);
  }
function (callback) {
    var cozyLight = require('./cozy-light');
    if (cozyLight.getStatus() === 'started') {
      cozyLight.setStopped();
      logger.info('Stopping apps...');
      return applicationHelpers.stopAll(function (appErr) {
        if (appErr) {
          logger.error('An error occurred while stopping applications');
          logger.raw(appErr);
        }

        logger.info('Stopping plugins...');
        pluginHelpers.stopAll(function (pluginErr) {
          if (pluginErr) {
            logger.error('An error occurred while stopping plugins');
            logger.raw(pluginErr);
          }

          logger.info('Stopping server...');
          var timeout = nodeHelpers.throwTimeout(
              'main server is too slow to stop...', 5000);

          mainAppHelper.stop(function(){
            clearTimeout(timeout);
            logger.info('\t' + symbols.ok + '\tmain server');
            nodeHelpers.invoke(callback);
          });
        });
      });
    }
    logger.debug('Apps already stopped');
    return nodeHelpers.invoke(callback);
  }
function ( callback ) { var cozyLight = require ( './cozy-light' ) ; if ( cozyLight . getStatus ( ) === 'started' ) { cozyLight . setStopped ( ) ; logger . info ( 'Stopping apps...' ) ; return applicationHelpers . stopAll ( function ( appErr ) { if ( appErr ) { logger . error ( 'An error occurred while stopping applications' ) ; logger . raw ( appErr ) ; } logger . info ( 'Stopping plugins...' ) ; pluginHelpers . stopAll ( function ( pluginErr ) { if ( pluginErr ) { logger . error ( 'An error occurred while stopping plugins' ) ; logger . raw ( pluginErr ) ; } logger . info ( 'Stopping server...' ) ; var timeout = nodeHelpers . throwTimeout ( 'main server is too slow to stop...' , 5000 ) ; mainAppHelper . stop ( function ( ) { clearTimeout ( timeout ) ; logger . info ( '\t' + symbols . ok + '\tmain server' ) ; nodeHelpers . invoke ( callback ) ; } ) ; } ) ; } ) ; } logger . debug ( 'Apps already stopped' ) ; return nodeHelpers . invoke ( callback ) ; }
Stop all running applications.

@param {Function} callback Termination.
Stop all running applications .