For systemd version >= 229, there is an option called RuntimeMaxSec, which terminates the service after it has been running for the given period of time.
e.g. To restart every 7 days:
[Service]
Restart=always
RuntimeMaxSec=7d
To me this seems more elegant than abusing Type=notify and WatchdogSec.
systemd provides a clean way to add and override directives in systemd unit files provided by vendors. Drop-In Units are described in man systemd.unit. For example, if you wanted to periodically restart the foo service provided by a package, you would create a file named /etc/systemd/system/foo.service.d/periodic-restart.conf. The contents would be as shown above. Then:
systemctl daemon-reload
systemctl restart foo
You can confirm that the Drop-In unit has been loaded because it will be reported in the status output:
systemctl status
Finally, you can confirm the directive has been included by searching the systemctl show output:
systemctl show foo.service | grep RuntimeMax
The directive reported by systemctl show will be “RuntimeMaxUSec`