Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-2009, 07:27 AM
Loyal Member
 
Posts: 77
Default Scripted Export / Import

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

Last edited by hspcd; 11-30-2009 at 09:05 AM.. Reason: Clarification
Reply With Quote
  #2 (permalink)  
Old 12-01-2009, 12:49 PM
Moderator
 
Posts: 1,147
Default

What are the permissions on the /opt/zimbra/working directory?
Reply With Quote
  #3 (permalink)  
Old 12-01-2009, 01:49 PM
Loyal Member
 
Posts: 77
Default

The directory permissions are 755 and the export files that my script creates (as the zimbra user) are 640.

As I said at first, I can run the two scripts manually as the zimbra user and it works fine. When the scripts are run from the zimbra user's crontab though the files are 0 bytes and thus the import fails.
Reply With Quote
  #4 (permalink)  
Old 12-01-2009, 02:47 PM
Moderator
 
Posts: 1,147
Default

What is the owner of the directory? (was looking for a ls -l, guess I should have said that)

Try putting a 2>/path/to/someTextFile so it has somewhere to output errors to.
Reply With Quote
  #5 (permalink)  
Old 12-01-2009, 07:05 PM
Loyal Member
 
Posts: 77
Default

ArcaneMagus, you are a great help! I needed to include the full path to zmmailbox in the scripts.

Thanks!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.