Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com

This Blog is protected by DMCA.com

huuphan.com. Powered by Blogger.

How to check zimbra account status

How to check zimbra account status? How to know zimbra account status pending. How to know zimbra account status active, closed, locked, maintenance. In my post, one bash script get all zimbra account status and zmaccts commands another.
Links to below you maybe likes:
zimbra custom spamassassin rules
How to create auto Bcc for Recipient mails for Zimbra 8.6
How to add spam filters on zimbra 8.6
How to create auto Bcc for sender mails for Zimbra 8.6
list accounts that has not logged in for the last x days in zimbra

How to check zimbra account status







Method 1: To bash script use zimbra ldap check zimbra account status.

#!/bin/bash
# sed ':a;N;$!ba;s/\n/ /g' file : command line
# :a create a label 'a'
# N append the next line to the pattern space
# $! if not the last line, ba branch (go to) label 'a'
# s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can)
# sed will loop through step 1 to 3 until it reach the last line, getting all lines fit in the pattern space where sed will substitute all \n characters
LDAP_HOST=`/opt/zimbra/bin/zmlocalconfig ldap_host | cut -d\ '' -f3`
LDAP_PASSWORD=`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | cut -d\ '' -f3`
LDAP_USERDN=`/opt/zimbra/bin/zmlocalconfig zimbra_ldap_userdn | cut -d\ '' -f3`
LDAPSEARCH="/opt/zimbra/bin/ldapsearch -D "$LDAP_USERDN" -w$LDAP_PASSWORD -H ldap://$LDAP_HOST -LLL -o ldif-wrap=no"
ZIMBRA_ACCOUNT_STATUS="zimbraAccountStatus"
DOMAIN=$1
$LDAPSEARCH "(&(objectClass=zimbraAccount)($ZIMBRA_ACCOUNT_STATUS=*)(mail=*$DOMAIN))" $ZIMBRA_ACCOUNT_STATUS | sed 's/ou=people,//g' | sed 's/dn: uid=/:/g' | sed 's/,dc=/@/' | sed 's/,dc=/./g' | sed 's/,dc=/./g' | sed ':a;N;$!ba;s/\n/ /g' | sed "s/$ZIMBRA_ACCOUNT_STATUS: //g" | sed 's/:/\n/g

Method 2: To use zmaccts command line check zimbra account status.

$ zmaccts | grep active | grep @mail.huuphan.local | awk '{print $1}'


post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

1 comments :

What if the most desired document or letter is lost or theft along with the letterbox? The result might be catastrophic sometime! So, it should be the foremost duty to ensure the safety of your documents outside the door. A secure and heavy duty locking mailbox can do this. We were in search of the best secure mailbox.

Relay