Path : /proc/2/root/var/lib/zabbix/ |
Current File : //proc/2/root/var/lib/zabbix/ldap_users_count.sh |
#!/bin/bash # Count ldap users ldapserver=`hostname` countfile=/tmp/mailusers if [ -s $countfile ] && [ `find $countfile -mmin -360` ] then count=`cat $countfile` else count=$(ldapsearch -H ldap://${ldapserver}/ -D "cn=admin,dc=au,dc=syrahost,dc=com" -w 66ctGEtqpQeyKcK3EVcpsBQBBuf2j8j2WHAf -b ou=users,dc=au,dc=syrahost,dc=com \(objectclass=account\)|grep 'dn:'|wc -l) echo $count > $countfile fi echo "$count"