We are trying to automate exporting and importing mail through two simple scripts and the zimbra user's crontab. The export script generates the files but they are zero length. Anybody got an idea of why, or how we might improve this process?
When we run these manually from the CLI as the zimbra user it works perfectly but when they are run by the zimbra user's crontab the files are zero length and the import obviously fails.
Thanks,
Export Script
#!/bin/sh
################################################## ################################################## ####################
# ISG Archive Mailbox - Import mail from ISG users
# Export User ISG Mail
zmmailbox -z -m
rmorgan@mycompany.com getRestURL "//Inbox/ISG?fmt=tgz" > /opt/zimbra/working/rex.tgz
sleep 30
zmmailbox -z -m
dthomas@mycompany.com getRestURL "//Inbox/ISG?fmt=tgz" > /opt/zimbra/working/dave.tgz
sleep 30
zmmailbox -z -m
rkinnane@mycompany.com getRestURL "//Inbox/ISG?fmt=tgz" > /opt/zimbra/working/rob.tgz
sleep 30
zmmailbox -z -m
abragg@mycompany.com getRestURL "//Inbox/ISG?fmt=tgz" > /opt/zimbra/working/adrienne.tgz
sleep 30
zmmailbox -z -m
rwilce@mycompany.com getRestURL "//Inbox/ISG?fmt=tgz" > /opt/zimbra/working/robert.tgz
################################################## ################################################## ####################
Import Script
# Import User ISG Mail
zmmailbox -z -m
isg_archive@mycompany.com postRestURL "//?fmt=tgz&resolve=replace" /opt/zimbra/working/rex.tgz
sleep 30
zmmailbox -z -m
isg_archive@mycompany.com postRestURL "//?fmt=tgz&resolve=replace" /opt/zimbra/working/dave.tgz
sleep 30
zmmailbox -z -m
isg_archive@mycompany.com postRestURL "//?fmt=tgz&resolve=replace" /opt/zimbra/working/rob.tgz
sleep 30
zmmailbox -z -m
isg_archive@mycompany.com postRestURL "//?fmt=tgz&resolve=replace" /opt/zimbra/working/adrienne.tgz
sleep 30
zmmailbox -z -m
isg_archive@mycompany.com postRestURL "//?fmt=tgz&resolve=replace" /opt/zimbra/working/robert.tgz