Skip to content

Instantly share code, notes, and snippets.

@alexalouit
Last active February 19, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexalouit/5745c360ff65a328232d to your computer and use it in GitHub Desktop.
Save alexalouit/5745c360ff65a328232d to your computer and use it in GitHub Desktop.
HTTPD (Apache and Nginx) regular email report, vhosts in errors reported
#!/bin/bash
#
# cron ex: 0 * * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/httpd-errors.sh >> /root/scripts/cron.log
email=""
if [ -f /etc/apache2/sites-available/*.err ]
then
CONTAIN=$(ls -lah /etc/apache2/sites-available/*.err)
echo -e "Erreur du serveur apache, vhost:\n $CONTAIN" | mail -s "Rapport d'erreur Apache" $email
fi
if [ -f /etc/nginx/sites-available/*.err ]
then
CONTAIN=$(ls -lah /etc/nginx/sites-available/*.err)
echo -e "Erreur du serveur nginx, vhost:\n $CONTAIN" | mail -s "Rapport d'erreur Nginx" $email
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment