Last active
February 19, 2018 10:21
-
-
Save alexalouit/4cd695c7279bcc9b9d3e to your computer and use it in GitHub Desktop.
Getmail survey lock file (semaphore)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# cron ex: */30 * * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/survey-semaphore-getmail.sh >> /root/scripts/cron.log | |
email="" | |
# file exist and have invalid ttl? | |
if [ -f /tmp/.getmail_lock ] | |
then | |
# have a correct ttl? | |
if [ $(find /tmp/.getmail_lock -type f -cmin +900) ] | |
then | |
# send alert | |
echo -e "Erreur du semaphore getmail sur le serveur:\n $(hostname)" | mail -s "Rapport d'erreur getmail" $email | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment