No need to do anything with the config string
egallup02360 committed
Jan 14, 2020 at 08:17 UTC
e458beda744c84d28ddd1a9715019760bb109676
1 file changed
+1
-1
meshcentral.js
+1
-1
@@ -167,7 +167,7 @@ function CreateMeshCentralServer(config, args) {
167
if ((error != null) || (stdout.indexOf('\n') == -1)) { console.log('ERROR: Unable to get node location: ' + error); process.exit(); return; }
168
var nodePath = stdout.substring(0, stdout.indexOf('\n'));
169
var config = '[Unit]\nDescription=MeshCentral Server\n\n[Service]\nType=simple\nLimitNOFILE=1000000\nExecStart=' + nodePath + ' ' + __dirname + '/meshcentral\nWorkingDirectory=' + userinfo.homedir + '\nEnvironment=NODE_ENV=production\nUser=' + userinfo.username + '\nGroup=' + userinfo.username + '\nRestart=always\n# Restart service after 10 seconds if node service crashes\nRestartSec=10\n# Set port permissions capability\nAmbientCapabilities=cap_net_bind_service\n\n[Install]\nWantedBy=multi-user.target\n';
170
- require('child_process').exec('echo \"' + config.split("\n").join("\n") + '\" | sudo tee ' + systemdConf, {}, function (error, stdout, stderr) {
170
+ require('child_process').exec('echo \"' + config + '\" | sudo tee ' + systemdConf, {}, function (error, stdout, stderr) {
171
if ((error != null) && (error != '')) { console.log('ERROR: Unable to write config file: ' + error); process.exit(); return; }
172
console.log('Enabling service...');
173
require('child_process').exec('sudo systemctl enable meshcentral.service', {}, function (error, stdout, stderr) {