blob: cdc8545963afef0af8d179612a971706db6e24c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
index a1f1208..47770b6 100644
--- a/server/helpers/launcher.js
+++ b/server/helpers/launcher.js
@@ -1,5 +1,5 @@
var kiwi_app = '../kiwi.js';
-var pidfile = '../../kiwiirc.pid';
+var pidfile = '/run/kiwiirc/kiwiirc.pid';
var pidfile_arg;
// Check if a pidfile has been set as an argument
@@ -16,6 +16,13 @@ if (process.argv.indexOf('-p') > -1) {
}
}
+try {
+ process.setgid('kiwiirc');
+ process.setuid('kiwiirc');
+} catch (e) {
+ console.error('Cannot switch to user kiwiirc. Try running as root.')
+ process.exit();
+}
var daemon = require('daemonize2').setup({
main: kiwi_app,
|