Commit | Line | Data |
---|---|---|
f74d73b7 | 1 | var kiwi_app = './kiwi.js';\r |
11dbb00f D |
2 | \r |
3 | \r | |
4 | var daemon = require('daemonize2').setup({\r | |
5 | main: kiwi_app,\r | |
6 | name: 'kiwiirc',\r | |
f74d73b7 | 7 | pidfile: '../kiwiirc.pid'\r |
11dbb00f D |
8 | });\r |
9 | \r | |
10 | switch (process.argv[2]) {\r | |
11 | case '-f':\r | |
12 | require(kiwi_app);\r | |
13 | break;\r | |
14 | \r | |
15 | case 'start':\r | |
16 | daemon.start();\r | |
17 | break;\r | |
18 | \r | |
19 | case 'stop':\r | |
20 | daemon.stop();\r | |
21 | break;\r | |
22 | \r | |
23 | case 'restart':\r | |
24 | daemon.stop(function(err) {\r | |
25 | daemon.start();\r | |
26 | });\r | |
27 | break;\r | |
28 | \r | |
29 | case 'status':\r | |
30 | var pid = daemon.status();\r | |
31 | if (pid)\r | |
32 | console.log('Daemon running. PID: ' + pid);\r | |
33 | else\r | |
34 | console.log('Daemon is not running.');\r | |
35 | break;\r | |
36 | \r | |
88f14637 D |
37 | case 'reconfig':\r |
38 | console.log('Loading new config..');\r | |
39 | daemon.sendSignal("SIGUSR1");\r | |
40 | break;\r | |
11dbb00f | 41 | \r |
5658034d D |
42 | case 'stats':\r |
43 | console.log('Writing stats to log file..');\r | |
44 | daemon.sendSignal("SIGUSR2");\r | |
45 | break;\r | |
46 | \r | |
531d0e52 | 47 | case 'build':\r |
2d22d7e2 | 48 | require('../client/assets/src/build.js');\r |
531d0e52 D |
49 | break;\r |
50 | \r | |
11dbb00f | 51 | default:\r |
531d0e52 | 52 | console.log('Usage: [-f|start|stop|restart|status|reconfig|build]');\r |
11dbb00f | 53 | } |