Guest User

Untitled

a guest
Jan 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. [~]# cat /etc/systemd/system/checkhung.timer
  2. [Unit]
  3. Description=Check if file not modified in a while and restart service
  4.  
  5. [Timer]
  6. OnActiveSec=60min
  7. OnUnitActiveSec=60min
  8.  
  9. [~]# cat /etc/systemd/system/checkhung.service
  10. [Unit]
  11. Description=Check if file not modified in a while and restart service
  12.  
  13. [Service]
  14. Type=oneshot
  15. ExecStart=/usr/local/bin/checker.sh
  16.  
  17. [~]# cat /usr/local/bin/checker.sh
  18. #!/bin/bash
  19.  
  20. if [[ $(find /path/to/the/file.txt -mmin +60) ]]
  21. then
  22. /usr/bin/systemctl restart my-service.service
  23. fi
Add Comment
Please, Sign In to add comment