-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathifip.sh
executable file
·41 lines (40 loc) · 1.3 KB
/
ifip.sh
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
38
39
40
#!/bin/bash
TMP="/tmp/msg`date +%s`"
FILES="/tmp/list`date +%N`"
DEPOT='/var/www/files.inria.fr/IFIP/New_additions'
TRAVAIL='/var/www/files.inria.fr/IFIP/data'
LOG='/var/www/files.inria.fr/IFIP/log'
TEMP='/tmp'
cat > $TMP
grep '^From:' $TMP | grep -i 'inria.fr' > /dev/null || {
echo "RECEPTION MAIL NON INRIA `date`" >> $LOG/error.txt
cat $TMP >> $LOG/error.txt
exit 1
}
grep '^IFIPAICT' $TMP > $FILES
sed 's|\.zip||g' $FILES > $FILES.tmp
sed 's|=20||g' $FILES.tmp > $FILES
cd $TRAVAIL
for i in `cat $FILES` ; do
echo "DEBUT DE TRAITEMENT $i `date`">> $LOG/$i.txt
grep '^From:' $TMP >> $LOG/$i.txt
[ -d $i ] && {
echo "FIN DE TRAITEMENT $i dossier deja traite">> $LOG/$i.txt
continue
}
[ -f $DEPOT/$i.zip ] || {
echo "FIN DE TRAITEMENT $DEPOT/$i.zip absent ">> $LOG/$i.txt
continue
}
unzip $DEPOT/$i.zip >> $LOG/$i.txt
[ -d __MACOSX ] && rm -rf __MACOSX/
ls $i |grep Part >> $LOG/$i.txt || {
echo "dossier sans Part ; on traite normalement">> $LOG/$i.txt
bash $TRAVAIL/modif_pdf.bash $i
}
ls $i |grep Part >> $LOG/$i.txt && {
echo "dossier avec Part XXXXX; on traite avec script specifique">> $LOG/$i.txt
bash $TRAVAIL/modif_pdf_avec_part.bash $i
}
echo "FIN DE TRAITEMENT $i">> $LOG/$i.txt
done