diff --git a/src/scheduler.js b/src/scheduler.js index bfc8408b6..3e7f2d5b8 100644 --- a/src/scheduler.js +++ b/src/scheduler.js @@ -14,7 +14,7 @@ let apps = require('./apps.js'), docker = require('./docker.js'), _ = require('underscore'); -// appId -> { schedulerConfig (manifest), cronjobs } +// appId -> { containerId, schedulerConfig (manifest), cronjobs } var gState = { }; @@ -124,7 +124,9 @@ function sync() { var schedulerConfig = app.manifest.addons ? app.manifest.addons.scheduler : null; if (!appState && !schedulerConfig) return iteratorDone(); // nothing to do - if (appState && _.isEqual(appState.schedulerConfig, schedulerConfig) && appState.cronJobs) return iteratorDone(); // nothing changed + if (appState && appState.cronJobs) { // we had created jobs for this app previously + if (_.isEqual(appState.schedulerConfig, schedulerConfig) && appState.containerId === app.containerId) return iteratorDone(); // nothing changed + } debug(`sync: adding jobs of ${app.id}`); @@ -139,7 +141,7 @@ function sync() { createJobs(app, schedulerConfig, function (error, cronJobs) { if (error) return iteratorDone(error); // if docker is down, the next sync() will recreate everything for this app - gState[app.id] = { schedulerConfig, cronJobs }; + gState[app.id] = { containerId: app.containerId, schedulerConfig, cronJobs }; iteratorDone(); }); diff --git a/src/scripts/stoptask.sh b/src/scripts/stoptask.sh index c6633c1c6..afc714a3f 100755 --- a/src/scripts/stoptask.sh +++ b/src/scripts/stoptask.sh @@ -29,4 +29,3 @@ else systemctl kill --signal=SIGTERM "${service_name}" || true systemctl stop "${service_name}" || true # because of remain-after-exit in Ubuntu 16 we have to deactivate the service fi -