I want to monitor one file of database in filesystem under this below path:
/var/lib/mysql/mydatabase/onetable.idb
I set a systemd service, but it doesn't recognize if the file changed. If I modify this file, nothing happend, but if the permission modified, it works. I tried to monitor this file with inotifywait as well, but I got same result.
As I know the systemd run as root, so I think there is not any permission problem. The path is 100% sure valid, because I can list the file directly.
Temporary solved this issue by insert this code in crontab:
*/3 * * * * test "`sudo find /var/lib/mysql/mydatabase/onetable.idb -mmin -4`" && /etc/myscript.sh
It's not permanent solution, because I want to do this trigger based script run.