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