Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [~]# cat /etc/systemd/system/checkhung.timer
- [Unit]
- Description=Check if file not modified in a while and restart service
- [Timer]
- OnActiveSec=60min
- OnUnitActiveSec=60min
- [~]# cat /etc/systemd/system/checkhung.service
- [Unit]
- Description=Check if file not modified in a while and restart service
- [Service]
- Type=oneshot
- ExecStart=/usr/local/bin/checker.sh
- [~]# cat /usr/local/bin/checker.sh
- #!/bin/bash
- if [[ $(find /path/to/the/file.txt -mmin +60) ]]
- then
- /usr/bin/systemctl restart my-service.service
- fi
Add Comment
Please, Sign In to add comment