Why changes in jobs.cfg cannot be monitored

aldomoro

Member
Feb 1, 2023
12
1
8
Hi
I would like to monitor if anybody changed what is backed up on our Proxmox VE and get e-mail about it. I have found if somebody changes backup jobs via web interface, this change is written to /etc/pve/jobs.cfg. If I run stat command then, I see time of change in access, modify and change attributes.

1706172342161.png

I have also observed If I manually edit jobs.cfg, this change is not written to the configuration in web interface. I see it works only in one direction.

I have installed inotify-tools to my proxmox and if I run this script, I can watch if jobs.cfg was changed.

#!/bin/bash

# Check if the file exist.
if [ ! -f "$1" ]; then
echo "File '$1' does not exist."
exit 1
fi

# Watch the file with `inotifywait`.
inotifywait -e modify -m "$1" | while read -r event; do
echo "File '$1' was changed"
done

Funny is, this script works (it monitors) if I change jobs.cfg manually in command line. If backup configuration is changed by web interface, the script does not work.
Do you know why when jobs.cfg has new date of modify?

Thank you
 
Funny is, this script works (it monitors) if I change jobs.cfg manually in command line. If backup configuration is changed by web interface, the script does not work.
Do you know why when jobs.cfg has new date of modify?
pmxcfs (/etc/pve/) is a cluster wide file system. So you will not get inotify events if content is modified using the cluster stack.