On an Ubuntu 16.04.3 LTS server I run some process monitors, but I also run apt manually as well as unattended-upgrades for security updates.
This sometimes causes the monitors to report and act on programs that were stopped by apt during apt upgrade.
Is there a way to run a command when unattended-upgrades/apt starts the upgrades (to stop the monitors) and again when unattended-upgrades/apt finishes (to restart the monitors)?
I found APT::Update::Pre-Invoke and APT::Update::Post-Invoke hooks but the apt update step is not the problem, and apt itself does not seem to have any pre/post upgrade hooks.