9f3d49b5a3d301229fe0f9e77d39a77fb301571d
1 var kiwi_app
= './kiwi.js';
2 var pidfile
= '../kiwiirc.pid';
4 // Check if a pidfile has been set as an argument
5 var pidfile_arg
= process
.argv
[process
.argv
.indexOf('-p') + 1];
7 // Don't set the relative path if we have an absolute path given to us
8 if (['/', '\\', '.'].indexOf(pidfile_arg
[0]) === -1) {
9 pidfile
= '../' + pidfile_arg
;
11 pidfile
= pidfile_arg
;
15 var daemon
= require('daemonize2').setup({
21 switch (process
.argv
[2]) {
35 daemon
.stop(function(err
) {
41 var pid
= daemon
.status();
43 console
.log('Daemon running. PID: ' + pid
);
45 console
.log('Daemon is not running.');
49 console
.log('Loading new config..');
50 daemon
.sendSignal("SIGUSR1");
54 console
.log('Writing stats to log file..');
55 daemon
.sendSignal("SIGUSR2");
59 require('../client/build.js');
63 console
.log('Usage: [-f|start|stop|restart|status|reconfig|build [-c <config file>] [-p <pid file>]]');