Skip to content

Instantly share code, notes, and snippets.

@thiagomgo
Created January 25, 2019 19:08
Show Gist options
  • Save thiagomgo/f046f487dc01429165d9fe1553ddcf97 to your computer and use it in GitHub Desktop.
Save thiagomgo/f046f487dc01429165d9fe1553ddcf97 to your computer and use it in GitHub Desktop.
Sync accounts using imapsync
#!/bin/bash
LISTA="/opt/sync-mail/list.txt"
LISTA_TMP="/tmp/list"
HOST_ORIGEM="xxx.xxx.xxx.xxx"
HOST_DESTINO="xxx.xxx.xxx.xxx"
cat ${LISTA}|grep -v "^#" | sed '/^ *$/d' > ${LISTA_TMP}
while IFS=: read usuario nome senha;do
echo -e "\n\nsyncing account ${usuario1}...\n\n"
imapsync --host1 ${HOST_ORIGEM} --user1 "${usuario}" --password1 "${senha}" --host2 ${HOST_DESTINO} --user2 "${usuario}" --password2 "${senha}" --delete2
done < ${LISTA_TMP}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment