Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
systemd: add housekeeping service unit
Problem: future housekeeping scripts should be run in a systemd cgroup for reliable termination, logging to the local systemd journal, and debugging using well known systemd tools. Add a systemd "oneshot" service unit for housekeeping. The service unit runs a user-provided /etc/flux/system/housekeeping script. It is configured so that 'systemctl start housekeeping' blocks until the the run is complete and its exit code reflects the exit code of the housekeeping script. Add a helper script that can be configured as an IMP run command. It runs 'systemctl start housekeeping' and traps SIGTERM, which can be sent to enforce a timeout. Upon receipt of SIGTERM, it stops the unit and exits with a nonzero code. To enable environment variables such as the FLUX_JOB_ID to be passed into the user-provided housekeeping script via the systemd unit, the helper script dumps its environment into /run/housekeeping.env, which is read in by the unit. Also of note: the user-provided scripts are automatically idempotent when run this way. systemd never starts multiple instances of the unit. If one is running when a start request is received, the second start blocks until the existing run finishes and reports its status.
- Loading branch information