1 var kiwi_app
= '../kiwi.js';
2 var pidfile
= '../../kiwiirc.pid';
5 // Check if a pidfile has been set as an argument
6 if (process
.argv
.indexOf('-p') > -1) {
7 pidfile_arg
= process
.argv
[process
.argv
.indexOf('-p') + 1];
10 // Don't set the relative path if we have an absolute path given to us
11 if (['/', '\\', '.'].indexOf(pidfile_arg
[0]) === -1) {
12 pidfile
= '../../' + pidfile_arg
;
14 pidfile
= pidfile_arg
;
20 var daemon
= require('daemonize2').setup({
26 switch (process
.argv
[2]) {
40 daemon
.stop(function(err
) {
46 var pid
= daemon
.status();
48 console
.log('Daemon running. PID: ' + pid
);
50 console
.log('Daemon is not running.');
54 console
.log('Loading new config..');
55 daemon
.sendSignal("SIGUSR1");
59 console
.log('Writing stats to log file..');
60 daemon
.sendSignal("SIGUSR2");
64 require('./build.js');
68 console
.log('Usage: [-f|start|stop|restart|status|reconfig|build [-c <config file>] [-p <pid file>]]');