I have a systemd timer set up to start a service every 5 minutes which runs mbsync to pull down my mail. Most of the time this works fine, but occassionally mbsync hangs (when the remote server disconnects unexpectedly etc.) and then no mail gets pulled down as mbsync is never restarted. What would be the best way of simply killing mbsync if it seems to be taking too long?
Assuming your service is of type "oneshot", I think setting TimeoutStartSec should do the trick.