2 recipients="root+git" # adresse pour l'envoi du mail
4 if [ "$1" != "cron" ]; then
5 echo "Ce script n'est pas fait pour être lancé manuellement mais via cron."
9 [ -x /usr/bin/git -a -d /.git ] || exit 0
13 echo "Erreur fatale de création de fichier temporaire."
16 trap "rm -f \"$tempfile\"" 0 1 2 3 15
18 (cd / ; /usr/bin/git status -a) |
19 sed -e '/^nothing to commit/d' -e 's/^#//' >"$tempfile"
21 if [ -s "$tempfile" ]; then
23 echo "From: git `hostname --fqdn` - Cron Daemon <root+git@`cat /etc/mailname`>"
24 echo "To: ${recipients}"
25 echo "Date: `date --rfc-2822`"
26 echo "Subject: git-status: `hostname --fqdn` - $0"
27 echo "Content-Type: text/plain; charset=utf-8"
29 echo "Voici la liste de modifications sur la machine `hostname --fqdn` qui n'ont pas encore été validées :"
30 echo "( voir http://wiki.auf.org/wikiteki/Git/SuiviDeConfiguration )"
33 ) | head -c 16k | /usr/sbin/sendmail ${recipients}