We would like to restart Jenkins in a non-intrusive way.
Although we can "prepare for shutdown" and close out all currently running tasks, teams inevitably are upset whenever this happens.
Instead, I would like to have a trigger which monitors for a time when there are no jobs running, and then jump in and restart the instance.
Teams won't mind waiting ~5 minutes for the instance to restart, but do mind waiting for longer running jobs to complete.
I'm thinking of a script that:
- in a loop, monitors the instance to determine when there are no jobs running
- if no jobs are running, prepare for shutdown and run the clean shutdown script
- restart the instance
Probably best to run this as a cluster operation. Does anything like this already exist?