Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imapsync and scripting #12

Closed
cyberdaemon opened this issue Dec 6, 2013 · 1 comment
Closed

imapsync and scripting #12

cyberdaemon opened this issue Dec 6, 2013 · 1 comment
Assignees
Labels

Comments

@cyberdaemon
Copy link

Hi,

I don´t know if this is a imapsync issue or just my script but I´ll try to explain it.
I have following script:

!/bin/bash

inputfile="migrate_accounts.txt"
host1="10.10.10.1"
host2="localhost"
logfile="/var/log/imapsyncbatch.log"

if [ ! -f $inputfile ]
then
{
echo "The input file does not exist! Exiting..." >> $logfile
exit;
}
fi

date=date +%X_-_%x
echo "$date IMAPSync started..." >> $logfile

tr ";" " " <$inputfile | while read u1 p1 u2 p2
do
date=date +%X_-_%x
echo "$date Start Syncing User $u1 to $u2" >> $logfile
imapsync --dry $1 --exclude Spamfilter.* --buffersize 8192000 --nosyncacls --syncinternaldates
--host1 $host1 --user1 "$u1" --password1 "$p1" --ssl1 --port1 993
--host2 $host2 --user2 "$u2" --password2 "$p2" --ssl2 --port2 993
date=date +%X_-_%x
echo "$date Finished $u1 to $u2" >> $logfile
done

date=date +%X_-_%x
echo "$date IMAPSync Finished..." >> $logfile
echo "$date ------------------------------------" >> $logfile

The migrate_accounts.txt file looks like this:
some.user@example1.com;mypass1;some.user@example1.com;mypass1;
some.user@example2.com;mypass2;some.user@example2.com;mypass2;

When I run the script it works fine for some users but for others there seems that imapsync can´t recognize the prefix and separator:

Host1 separator and prefix: [.][INBOX.]
Host2 separator and prefix: [/][Other Users/]

Obviously "Other Users separator "doesn´t exist on the target server so imapsync tries to create them.

I tried to alter the script with --sep2 / --prefix 2 "". This gives me so far the correct prefix and separator but imapsync still tries to create the INBOX Trash Spam etc even though this folders exists on the target server.

And now when i try to run this from the cli

imapsync --dry --exclude Spamfilter.* --buffersize 8192000 --nosyncacls --syncinternaldates
--host1 10.10.10.1 --user1 some.user@example1.com --password1 mypass1 --ssl1 --port1 993
--host2 localhost --user2 usser@example1.com--password2 mypass1 --ssl2 --port2 993 \

it works.

So I dont´t know exactly whats going on. Thank you.

@gilleslamiral
Copy link
Member

Hi,

If it works on cli then your script is wrong.

Le 06/12/2013 07:14, cyberdaemon a écrit :

Hi,

I don´t know if this is a imapsync issue or just my script but I´ll try to explain it.
I have following script:

And now when i try to run this from the cli
it works.

Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants