UNPKG

866 BJavaScriptView Raw
1/*
2 * index.js: Top-level include for the `forever-monitor` module.
3 *
4 * (C) 2010 Charlie Robbins & the Contributors
5 * MIT LICENCE
6 *
7 */
8
9var utile = require('utile'),
10 common = require('./forever-monitor/common');
11
12exports.kill = common.kill;
13exports.checkProcess = common.checkProcess;
14exports.Monitor = require('./forever-monitor/monitor').Monitor;
15
16//
17// Expose version through `pkginfo`
18//
19exports.version = require('../package').version;
20
21//
22// ### function start (script, options)
23// #### @script {string} Location of the script to run.
24// #### @options {Object} Configuration for forever instance.
25// Starts a script with forever
26//
27exports.start = function (script, options) {
28 if (!options.uid) {
29 options.uid = options.uid || utile.randomString(4).replace(/^\-/, '_');
30 }
31
32 return new exports.Monitor(script, options).start();
33};