Results 1 to 2 of 2

Thread: Search Parent Account Connected to Which Child Account

  1. #1
    Gleipner is offline Starter Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    3

    Default Search Parent Account Connected to Which Child Account

    I have been using the zmprov for connecting mail account to shared mailboxes (child account). It was a little procedure to get it all to work, and I decided to made a script for that so it should be more administrator friendly.
    The script works great, it can add, remove and check child account which parent that the child are connected to.

    Now here is my question, if you want to check the parent account to see which child account it is connected to, is it possible to do that?
    I will include my script so you can see if I have made something wrong with it or maybe forgot something.

    #!/bin/sh
    WHO=`whoami`
    if [ $WHO != "zimbra" ]
    then
    echo
    echo "Execute this script as user zimbra (\"su - zimbra\")"
    echo
    exit 1
    fi
    echo "Username of the Mail Account"
    read parent
    echo "Username of the Shared MailBox Account"
    read child
    childid=`zmprov ga $child@domain.se | grep zimbraId: | awk '{print$2}'`
    echo "ID for $child@domain.se is: "
    echo $childid

    echo "What to do? 1=Add mailbox 2=Remove mailbox 3=Check users on mailbox"
    read test
    if [ $test -eq 1 ]
    then

    `zmprov ma $parent@domain.se +zimbraChildAccount $childid`
    `zmprov ma $parent@domain.se +zimbraPrefChildVisibleAccount $childid`
    list=`zmprov sa zimbraChildAccount=$childid`
    printf "\n$list"
    echo ""

    elif [ $test -eq 2 ]
    then
    `zmprov ma $parent@domain.se -zimbraChildAccount $childid`
    `zmprov ma $parent@domain.se -zimbraPrefChildVisibleAccount $childid`
    list=`zmprov sa zimbraChildAccount=$childid`
    printf "\n$list"
    echo ""

    elif [ $test -eq 3 ]
    then
    list=`zmprov sa zimbraChildAccount=$childid`
    echo
    printf "\n$list"
    echo ""
    fi

    Thanks in advanced

  2. #2
    drei is offline Intermediate Member
    Join Date
    Mar 2007
    Location
    Zurich, Switzerland
    Posts
    15
    Rep Power
    8

    Lightbulb Modified version of the script

    Hi

    Found your script and it was very helpful to me.
    I added the part you were looking for and slightly reordered the sequence of events. Find the modified script below.

    Cheers,
    David.

    Code:
    #!/bin/sh
    WHO=`whoami`
    if [ $WHO != "zimbra" ]
    then
    	echo
    	echo "Execute this script as user zimbra (\\"su - zimbra\\")"
    	echo
    	exit 1
    fi
    
    echo "What to do? 1=Add child mailbox 2=Remove child mailbox 3=List child mailboxes 4=Check uparents on child"
    read test
    
    if [ $test -eq 1 ] || [ $test -eq 2 ] || [ $test -eq 3 ]
    then
    	echo "Username of the Parent Mail Account"
    	read parent
    fi
    
    if [ $test -eq 1 ] || [ $test -eq 2 ] || [ $test -eq 4 ]
    then
    	echo "Username of the Child Mailbox Account"
    	read child
    	childid=`zmprov ga $child | grep zimbraId: | awk '{print$2}'`
    	echo "ID for $child is: "
    	echo $childid
    fi
    
    if [ $test -eq 1 ]
    then
    
    	`zmprov ma $parent +zimbraChildAccount $childid`
    	`zmprov ma $parent +zimbraPrefChildVisibleAccount $childid`
    	list=`zmprov sa zimbraChildAccount=$childid`
    	printf "\\n$list"
    	echo ""
    
    elif [ $test -eq 2 ]
    then
    	`zmprov ma $parent -zimbraChildAccount $childid`
    	`zmprov ma $parent -zimbraPrefChildVisibleAccount $childid`
    	list=`zmprov sa zimbraChildAccount=$childid`
    	printf "\\n$list"
    	echo ""
    
    elif [ $test -eq 3 ]
    then
    	echo 'get child ids...'
    	listChild=`zmprov ga $parent | grep 'zimbraChildAccount' | awk '{print $2}'`
    	echo "list `echo $listChild | wc -l` child accounts..."
    	for c in $listChild;
    	do
    		child=`zmprov ga $c | grep '# name' | awk '{print $3}'`
    		printf "\\n$child"
    	done
    	echo ''
    
    elif [ $test -eq 4 ]
    then
    	list=`zmprov sa zimbraChildAccount=$childid`
    	echo
    	printf "\\n$list"
    	echo ""
    fi

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] zmmtaconfig error - no child processes
    By gracedman in forum Administrators
    Replies: 1
    Last Post: 06-02-2009, 10:30 AM
  2. Replies: 20
    Last Post: 03-18-2008, 05:37 AM
  3. [SOLVED] Debian Etch 32 / 64: MTA not working
    By xflip in forum Installation
    Replies: 2
    Last Post: 01-18-2008, 04:58 AM
  4. Cannot login as admin after install
    By elesouef in forum Installation
    Replies: 23
    Last Post: 02-13-2007, 09:06 AM
  5. Seeming variety of problems on suse-9.1
    By Crexis in forum Installation
    Replies: 52
    Last Post: 03-04-2006, 12:19 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
  •