Results 1 to 5 of 5

Thread: Bash: how to send commands to zmprov and zmmailbox instead of launching zm* each time

Threaded View

  1. #1
    Join Date
    Jul 2006
    Location
    Australia, ACT
    Posts
    197
    Rep Power
    9

    Question Bash: how to send commands to zmprov and zmmailbox instead of launching zm* each time

    Hi Everyone,

    I've got a collection of bash scripts which would execute far faster if I could launch an instance of zmmailbox and zmprov once and then just send commands to those instances. Instead of launching zmmailbox for a single command, getting the result and then destroying it. Which requires initiating a Java environment, executing the command and then tearing Java down again.

    For example: executing this command 1,000 times is very inefficient.
    /opt/zimbra/bin/zmprov ga {account}@test.com

    However, I would like to do this:
    zmprov
    ga {account-1}@test.com | pipe result to calling script
    ga {account-2}@test.com | pipe result to calling script
    ga {account-3}@test.com | pipe result to calling script

    Here is an example bash script I would like to optimise:

    Code:
    ZIMBRA_ACCOUNTS=`su - zimbra --command='/opt/zimbra/bin/zmprov -l gaa'`;
    
    for ZIMBRA_ACCOUNT in $ZIMBRA_ACCOUNTS; do
           # Get all attributes for this account, slow as zmprov has to initiate
           ZIMBRA_ACCOUNT_DETAILS="`su - zimbra --command='/opt/zimbra/bin/zmprov ga '$ZIMBRA_ACCOUNT''`";
           [DO SOME INTERESTING THINGS HERE ...]
    done;
    Any suggestions on best to do this? I appreciate that it may not be a specific Zimbra problem but a general bash question.

    Cheers!
    Last edited by greenrenault; 01-15-2010 at 03:12 PM. Reason: Adding code tags

    http://agilemail.com.au

    Your Australian Zimbra experts
    Sales, consulting, installation, support

Similar Threads

  1. [SOLVED] can not find the CLI commands like zmprov
    By Gil Bauman in forum General Questions
    Replies: 1
    Last Post: 05-19-2009, 04:11 AM

Posting Permissions

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