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