Do something for all accounts

#!/bin/bash

# script skeleton to do something for all accounts, except ${exclude_accounts}.

# this script should be run as root

# customize these to your needs:
exclude_accounts="admin wiki galsync system-ham system-spam system-virus-quarantine"

# get all account to $accounts
accounts=`su - zimbra -c 'zmprov -l gaa'`;

# loop for each account
for account in ${accounts}; do
  account_uid=`echo ${account} | cut -d '@' -f1`  
  echo ${exclude_accounts} | grep -q -e ${account_uid}
  if [ $? -eq 0 ] ; then
    echo "### Skipped ${account}"
    continue
  fi

  # your code starts here:
  echo "Processing ${account} ..."
      
done
zimbra/do_something_for_all_accounts.txt · Last modified: 2011-12-28 16:35 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0