Results 1 to 5 of 5

Thread: Scripted Export / Import

  1. #1
    hspcd is offline Loyal Member
    Join Date
    Nov 2007
    Location
    HSP NC
    Posts
    77
    Rep Power
    7

    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 10:05 AM. Reason: Clarification

  2. #2
    ArcaneMagus's Avatar
    ArcaneMagus is offline Moderator
    Join Date
    Feb 2007
    Location
    Portland, OR
    Posts
    1,147
    Rep Power
    10

    Default

    What are the permissions on the /opt/zimbra/working directory?

  3. #3
    hspcd is offline Loyal Member
    Join Date
    Nov 2007
    Location
    HSP NC
    Posts
    77
    Rep Power
    7

    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.

  4. #4
    ArcaneMagus's Avatar
    ArcaneMagus is offline Moderator
    Join Date
    Feb 2007
    Location
    Portland, OR
    Posts
    1,147
    Rep Power
    10

    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.

  5. #5
    hspcd is offline Loyal Member
    Join Date
    Nov 2007
    Location
    HSP NC
    Posts
    77
    Rep Power
    7

    Default

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

    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] my server stopped working???
    By cecil in forum Administrators
    Replies: 4
    Last Post: 04-20-2008, 08:07 AM
  2. installation error during ldap setup
    By ljramos in forum Installation
    Replies: 23
    Last Post: 08-10-2007, 10:48 PM
  3. unable to restart zimbra after reboot
    By droefs in forum Administrators
    Replies: 28
    Last Post: 04-16-2006, 02:33 PM
  4. Replies: 16
    Last Post: 01-05-2006, 09:55 AM
  5. After Succesfull Install, Cannot Start mta
    By bsimzer in forum Installation
    Replies: 26
    Last Post: 12-16-2005, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •