Results 1 to 2 of 2

Thread: Simply get zimbraDomainDefaultCOSId from zmprov

  1. #1
    Join Date
    Apr 2009
    Posts
    61
    Rep Power
    6

    Default Simply get zimbraDomainDefaultCOSId from zmprov

    Hello there,

    simply using ldap query by

    /opt/zimbra/bin/ldapsearch -x -D `zmlocalconfig -m nokey -s zimbra_ldap_userdn` -w `zmlocalconfig -m nokey -s zimbra_ldap_password` -h `hostname -f` zimbraDomainDefaultCOSId
    I can obtain a list of all domains and eventuali zimbraDomainDefaultCOSId parameter associated to domain name, but there is no way to know by ldap query (or GUI search, preferred) what domain is associated to a single COS?

    Ex:

    default
    cosID: f6348481-c0a5-4c68-996a-f5cb6755faa3

    unlimited
    codID: f6348481-c0a5-4c68-996a-f5cb6755fa22

    ldapsearch zimbraDomainDefaultCOSId=f6348481-c0a5-4c68-996a-f5cb6755faa3

    result: foo.com, bar.com, ....

    ldapsearch zimbraDomainDefaultCOSId=f6348481-c0a5-4c68-996a-f5cb6755fa22

    result: this.com, that.com, ....
    it may be usefull, don't know how to reach this goal.

    Thanks for help @ all.

    A.

  2. #2
    Join Date
    Apr 2009
    Posts
    61
    Rep Power
    6

    Default

    Self response.

    I've done a stupid script that

    1 - search for DomainCOSId(s) by zmprov
    2 - ask user to search into ldap for CosID (provided by previous list) just copy/pasting cosID
    3 - print a screen with domains belong to that CosID

    nothing special, it does what I'm searching for, maybe someone interested too

    Please save it as read_domainCOS.sh (or whatever you want) and run it as zimbra user (root not allowed).

    Code:
    #!/bin/bash
    
    clear
    
    IFS=$'\n'
    
    
    if [ $(whoami) == "zimbra" ];
    
    then
    
    dest=$(mktemp /tmp/tmp.XXXXXXX)
    myfile=$(mktemp /tmp/tmp.XXXXXXX)
    :> $dest
    :> $myfile
    
    for row in $(zmprov gac -v | grep -e cn: -e zimbraId|grep -v ^zimbraIdentity)
    
    do
    
    echo "$row" >> $dest
    
    done
    
    cat $dest|sed 's/cn:/------------------------------------\nCOS NAME:/g'|sed 's/zimbraId:/ZIMBRA ID:/g' > $myfile
    echo "------------------------------------" >> $myfile
    
    cat $myfile
    
    echo -e "\n\nPlease copy/paste CosID (from above) to search:"
    read cosid
    
    clear
    
    echo -e "Sorted list of CosID domains searched for (by id : $cosid)\n\n"
    
    /opt/zimbra/bin/ldapsearch -x -D `zmlocalconfig -m nokey -s zimbra_ldap_userdn` -w `zmlocalconfig -m nokey -s zimbra_ldap_password` -h `hostname -f` zimbraDomainDefaultCOSId|grep -B1 $cosid|grep "dn"|sed 's/,dc=/./g'|cut -f2 -d"=" > $dest
    
    if [ "$(cat $dest|wc -l)" -gt "0" ]
    
    then
    
    cat $dest|sort
    
    else
    
    echo "Something goes wrong... Are you sure that given CosID exists (copy/paste full id) ?"
    echo "Please re-run."
    
    fi
    
    echo -e "\n\n"
    
    rm -f $dest $myfile
    
    else
    
    echo "This script cannot be run as $(whoami), run it as zimbra user."
    
    fi
    Last edited by lovelord; 12-09-2013 at 09:25 AM.

Similar Threads

  1. Simply cannot install 7.1.1
    By cabletastic in forum Installation
    Replies: 15
    Last Post: 09-27-2012, 08:54 PM
  2. Replies: 0
    Last Post: 09-06-2012, 07:34 AM
  3. Synchronize Zimbra + Outlook + Simply + other
    By rotorboy in forum Migration
    Replies: 3
    Last Post: 06-01-2012, 03:13 PM
  4. Replies: 13
    Last Post: 08-10-2009, 04:00 AM
  5. Mail delivered for a while then simply queued
    By billybofh in forum Administrators
    Replies: 20
    Last Post: 02-23-2006, 08:36 AM

Tags for this Thread

Posting Permissions

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