Score:0

Unattended Upgrade End Script

cf flag

I have the need of notifying my fleet management system every time unattended-upgrades run, and sending some information on the packages updated. Is there any way to detect the end of unattended upgrade and launch a script when the process ends?

So far I have a script that runs daily with this approach:

  1. I check for /var/log/unattended-upgrades/unattended-upgrades.log existence.
  2. If it exists, parse info from it and report back to the server the update status.
  3. Delete the file

Unattended-upgrades run weekly, but the log file is still created daily. Having a hook on unattended-upgrades run would be very handy in my use case, to avoid false reporting.

Score:1
cn flag

Use a systemd path job to listen for changes to the file /var/lib/apt/periodic/unattended-upgrades-stamp

That file gets touched when unattended upgrades completes operation. There is no data in the file; the touch merely updates the 'modified' timestamp in the filesystem.

cf flag
Nice approach. Thanks, I'll try systemd path job.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.