My setup has a systemd service that should periodically write to a file. I would like to monitor the file for changes, so when it hasn't been modified for a while, I know the service has bugged out. I would like to be able to automatically restart the service when that happens.
I have tried using the path unit file, but it can only start a command when the monitored file is changed, not the other way round.
The opposite question has been asked, where the service needs to be restarted when a file was changed, but the solution doesn't seem to be directly applicable to my situation.