diff --git a/deploy/codebase/lamassu-machine-manager.js b/deploy/codebase/lamassu-machine-manager.js index 228a51c09..dccc6f350 100644 --- a/deploy/codebase/lamassu-machine-manager.js +++ b/deploy/codebase/lamassu-machine-manager.js @@ -80,14 +80,14 @@ function updateSupervisor (cb) { .split('\n') .flatMap(line => { const service = line.split(' ', 1)?.[0] - return (!service || service === 'lamassu-watchdog') ? [] : [service] + return service ? [service] : [] }) - .join(' ') + .filter(service => service !== 'lamassu-watchdog') /* * NOTE: Keep old behavior in case we don't get the expected output: * update and restart all services. result:finished won't work. */ - return services.length > 0 ? services : 'all' + return services.length > 0 ? services : ['all'] } try { @@ -96,19 +96,21 @@ function updateSupervisor (cb) { } catch (err) { return err.status === 3 ? extractServices(err.stdout) : - 'all' /* NOTE: see note above */ + ['all'] /* NOTE: see note above */ } } const osuser = getOSUser() const services = getServices() + const allServices = services.join(' ') + const servicesNoCalibrateScreen = services.filter(service => service !== 'calibrate-screen').join(' ') const commands = [ async.apply(command, `cp ${supervisorPath}/* /etc/supervisor/conf.d/`), + async.apply(command, `sed -i 's|^user=.*\$|user=${osuser}|;' /etc/supervisor/conf.d/lamassu-browser.conf || true`), async.apply(command, `rm -f /etc/supervisor/conf.d/calibrate-screen.conf`), - async.apply(command, `supervisorctl update ${services}`), - async.apply(command, `supervisorctl stop ${services}`), - async.apply(command, `sed -i 's|^user=.*\$|user=${osuser}|;' /etc/supervisor/conf.d/lamassu-browser.conf || true`) + async.apply(command, `supervisorctl update ${allServices}`), + async.apply(command, `supervisorctl stop ${servicesNoCalibrateScreen}`), ] if (machineCode === 'aveiro') { @@ -117,7 +119,7 @@ function updateSupervisor (cb) { commands.push(async.apply(command, `chmod +x /opt/FujitsuGSR50/FujitsuGSR50`)) } - commands.push(async.apply(command, `supervisorctl restart ${services}`)) + commands.push(async.apply(command, `supervisorctl restart ${servicesNoCalibrateScreen}`)) async.series(commands, err => { if (err) throw err;