forked from jtordgeman/Modular-Node.js-IRC-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
executable file
·47 lines (38 loc) · 1.3 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
var chalk = require('chalk');
if (typeof argv != 'undefined') {
var daemon = require("daemonize2").setup({
main: "main.js",
name: "ModularBot",
pidfile: "./lib/modularbot.pid"
});
switch (process.argv[2]) {
case "start":
daemon.start();
break;
case "stop":
daemon.stop();
break;
case "kill":
daemon.kill();
break;
case "restart":
daemon.stop(function(err) {
daemon.start();
});
break;
case "status":
var pid = daemon.status();
if (pid)
console.log(chalk.white("[DAEMON]") + chalk.green(" ModularBot's daemon running. PID: " + pid));
else
console.log(chalk.white("[DAEMON]") + chalk.green(" ModularBot's daemon is not running."));
break;
default:
console.log(chalk.white("[DAEMON]") + chalk.green(" Daemon Sevice -- For Normal mode, execute main.js"));
console.log(chalk.white("[DAEMON") + chalk.green(" Usage: node app.js [start|stop|kill|restart|status]"));
}
} else {
console.log(chalk.white("[DAEMON]") + chalk.green(" Daemon Sevice -- For Normal mode, execute main.js"));
console.log(chalk.white("[DAEMON]") + chalk.green(" Usage: node app.js [start|stop|restart|status]"));
}