|
Directory : /scripts2/ |
#!/bin/bash
HOST1=$1
HOST2=$HOSTNAME
SRC=$2
if ! [ $HOST1 ]; then
echo "Missing remote hostname."
exit 1
elif ! [ $SRC ]; then
echo "Missing source file."
exit 2
fi
> mailbox_ok.txt
> mailbox_error.txt
{ while IFS=';' read u p1 p2 IGNORE
do
if imapsync --host1 "$HOST1" --user1 "$u" --password1 "$p1" \
--host2 "$HOST2" --user2 "$u" --password2 "$p2"
then
echo "$u: migration was successful." | tee -a mailbox_ok.txt
else
echo "$u: migration finished with an error -> $?." | tee -a mailbox_error.txt
fi
done
echo "$HOST1: migration finished. Logs in mailbox_ok.txt, mailbox_error.txt, LOG_imapsync/."
} < "$SRC"