var kiwi_app = './kiwi.js';\r
+var pidfile = '../kiwiirc.pid';\r
\r
+// Check if a pidfile has been set as an argument\r
+var pidfile_arg = process.argv[process.argv.indexOf('-p') + 1];\r
+if (pidfile_arg) {\r
+ // Don't set the relative path if we have an absolute path given to us\r
+ if (['/', '\\', '.'].indexOf(pidfile_arg[0]) === -1) {\r
+ pidfile = '../' + pidfile_arg;\r
+ } else {\r
+ pidfile = pidfile_arg;\r
+ }\r
+}\r
\r
var daemon = require('daemonize2').setup({\r
main: kiwi_app,\r
name: 'kiwiirc',\r
- pidfile: '../kiwiirc.pid'\r
+ pidfile: pidfile\r
});\r
\r
switch (process.argv[2]) {\r
case 'build':\r
require('../client/build.js');\r
break;\r
- \r
+\r
default:\r
- console.log('Usage: [-f|start|stop|restart|status|reconfig|build [-c <config file>]]');\r
+ console.log('Usage: [-f|start|stop|restart|status|reconfig|build [-c <config file>] [-p <pid file>]]');\r
}\r