Skip to content

Commit 7c7f8dc

Browse files
author
hamza
committed
permettre la gestion des utilisateur en erreur
1 parent 41dad2e commit 7c7f8dc

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

CompteSynchro.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
toto@toto.fr:password1:toto@newtoto.fr:password2
1+
test@test.fr:password1:tata@test.fr:password1

imapsync.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,36 @@ VERS=1.0.0
1414
echo -e "\e[00;31mVersion ${VERS} -> if(Question) mailto([email protected]) use imapsync --help for more support\e[00m"
1515
# Si besoin d'options supplementaire -> For example : --tls1 --tls2 pour activer le tls voir imapsync --help pour avoir la liste
1616
# des options.
17-
17+
cp imapsync /usr/bin/
1818
OPTION="--tls1 --tls2"
1919

2020
echo "Nous allons commencer le sync des comptes : "
21-
21+
timestamp=$(date +%Y_%m_%d_%H_%M_%S)
2222
#Le serveur Source :
2323
HOST1=
2424

2525
#Le serveur de destinations :
2626
HOST2=
2727

28-
while IFS=: read user1 password1 user2 password2
28+
{ while IFS=":" read user1 password1 user2 password2
2929
do
30-
echo "Synchro du compte ${user1}:"
31-
imapsync \
32-
--host1 ${HOST1} --user1 ${user1} --password1 ${password1}\
30+
31+
32+
if imapsync \
33+
--host1 ${HOST1} --user1 ${user1} --password1 ${password1} \
3334
--host2 ${HOST2} --user2 ${user2} --password2 ${password2} ${OPTION}
34-
done < CompteSynchro.txt
35+
echo "Synchro du compte ${user1}:";
36+
then
37+
38+
continue
39+
fi
40+
41+
3542

43+
done } < CompteSynchro.txt
44+
cd LOG_imapsync/
45+
{ for filename in *.txt; do grep 'Failure' $filename | tail -1 | grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b"; done } > log.txt
46+
cp log.txt ../log_${timestamp}.txt
47+
cd ../
48+
cp -R LOG_imapsync LOG_impasync_${timestamp}
49+
rm -R LOG_imapsync

0 commit comments

Comments
 (0)