-
Notifications
You must be signed in to change notification settings - Fork 0
/
mail-subst
executable file
·37 lines (29 loc) · 906 Bytes
/
mail-subst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
if [[ $1 == "" ]]
then
echo kein Nutzername angegeben
exit 1
fi
LOG=/var/log/mail-subst.log
touch $LOG
KOLLEGE=$1
if [ $(date +"%H") -lt 15 ]
then
if ! $(cat /var/www/Dropbox/vp-export/display-leh/f1/* | grep "Betroffen\|Abwesend" | grep $KOLLEGE > /dev/null)
then
if ! $(cat /var/www/Dropbox/vp-export/display-leh/f2/* | grep "Betroffen\|Abwesend" | grep $KOLLEGE > /dev/null)
then
exit 0
fi
fi
else
if ! $(cat /var/www/Dropbox/vp-export/display-leh/f2/* | grep "Betroffen\|Abwesend" | grep $KOLLEGE > /dev/null)
then
if ! $(cat /var/www/Dropbox/vp-export/display-leh/f2/* | grep "Betroffen\|Abwesend" | grep $KOLLEGE > /dev/null)
then
exit 0
fi
fi
fi
/usr/bin/show-subst $1 | /usr/bin/mail -r "[email protected]" -s "Vertretungen für $(date)" "[email protected]"
echo "$(date): Für User $1 wurde eine Mail angefordert." >> $LOG