Created
September 16, 2016 13:09
-
-
Save dhyegocalota/672677b0c75565573b389b8f47348cea to your computer and use it in GitHub Desktop.
imapsync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
error() { echo "$@" 1>&2; } | |
file=$1 | |
if [ -z $file ]; then | |
error "Usage \`./migrate credentials.txt\`" | |
exit 1 | |
fi | |
echo Looping on account credentials found in $file | |
echo | |
while IFS=';' read h1 u1 p1 h2 u2 p2; do | |
# Skip commented lines in $file | |
{ echo "$h1" | egrep "^#" ; } > /dev/null && continue | |
echo "==== Starting imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ====" | |
imapsync \ | |
--host1 "$h1" --user1 "$u1" --password1 "$p1" --ssl1 \ | |
--host2 "$h2" --user2 "$u2" --password2 "$p2" --ssl2 \ | |
"$@" > /dev/null 2>&1 | |
echo "==== Ended imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ====" | |
echo | |
done < $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment