code: function(type, action, name, opts, emitter) {
    logger.info('Running: ' + name)
    running[name] = action;
  
    emitter.once('end', function(err, out) {
      if (err) hooks.trigger('error', err);
  
      logger.info('Stopped: ' + name);
      action_stopped(name);
  
      setTimeout(function() {
        hooks.trigger(type, 'stopped', name, opts, err, out);
      }, 1000);
  
      if (action.events)
        emitter.removeAllListeners();
    })
  
    if (!action.events) return;
    watch_action_events(action.events, emitter);
  }
docs: type can be 'action' or 'trigger'