Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-2008, 11:35 AM
Senior Member
 
Posts: 73
Default Query for non-used accounts

Hi gang! Does anyone know of a query that I could run, that would poll for unused email accounts? We currently give accounts to all users, but I know that many don't use them. A query that would list open account, that have not been logged into in over a month would be great. Does anyone know how this could be done?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 09-30-2008, 12:09 PM
Moderator
 
Posts: 1,554
Default

this is easier than that. log into the admin web interface. on the bottom of th left hand side you'll see a "Searches" area that should have "Inactive accounts (30 days)"
Reply With Quote
  #3 (permalink)  
Old 08-26-2009, 06:40 AM
New Member
 
Posts: 4
Default

Is there any way to export this report out to any other format? I did it last year, but can't remember how. All I remember was that it was insanely time-consuming and I guessed that I was reinventing the wheel.
Reply With Quote
  #4 (permalink)  
Old 08-26-2009, 07:33 AM
Outstanding Member
 
Posts: 708
Default

Utility script that I call "rootsearch":
Code:
#!/bin/sh
/opt/zimbra/openldap/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn|awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password|awk '{print $3}'`" -H `/opt/zimbra/bin/zmlocalconfig ldap_url|awk '{print $3}'` $*
And then you can list usernames and other potentially useful information with
Code:
rootsearch '(zimbraLastLogonTimestamp<=20090528141404Z)' uid zimbraprefmailforwardingaddress zimbraaccountstatus uid
You can only do <= searches on timestamps. To do a > search, you need negation: (!(zimbraLastLogonTimestamp<=20090528141404Z))
Reply With Quote
  #5 (permalink)  
Old 08-26-2009, 08:05 AM
New Member
 
Posts: 4
Default

thanks for the quick repsonse. unfortunately, i'm not a big unix buy. i was able to run the first command in putty, but i'm thinking i have to use your code to create the rootsearch utility???
this looks like exactly what I need, but i inherited this system and i'm still not up to speed on the unix side of things. (windows fan-boy here)
any other information you could provide would be extremely helpful and more than appreciated.
Reply With Quote
  #6 (permalink)  
Old 08-26-2009, 11:05 PM
Elite Member
 
Posts: 296
Default

i write a script several days ago for similiar purpose and i hope this could help your case.

Run script like this :
( to get users never login and login 30 days ago into /tmp/user.list file)
./myscript.sh 30



Code:
#!/bin/bash

if [ $# -ne 1 ]; then
   echo "Usage: $0 day"
   echo "Example: $0 30"
   exit 2
fi

domain="@example.com"
ACCT=/tmp/acct.txt
OUTPUT=/tmp/user.list

rm -rf $ACCT $OUTPUT

zmaccts | grep $domain | sed /wiki/d | sed /admin/d | sed /spam./d | sed /ham./d
 > $ACCT

today=`date '+%s'`
userinput=`echo "$1*24*60*60" | bc`

cat $ACCT |
while read line; do
   name=`echo $line | awk '{print $1}'`
   if [ `echo $line | awk '{print $5}'` = "never" ]; then 
      echo "$name never" >> $OUTPUT
          continue
   else
      lastlogin=`echo $line | awk '{print $5}' | awk -F/ '{print 2000+$3 $1 $2}'
`
   fi

  last=`date -d $lastlogin '+%s'`
  if [ `echo "$today - $last" | bc` -ge $userinput ]; then
     echo "$name $lastlogin" >> $OUTPUT
  fi

done
Reply With Quote
  #7 (permalink)  
Old 08-27-2009, 06:34 AM
New Member
 
Posts: 4
Default

Thanks. I'll try that out.
Reply With Quote
  #8 (permalink)  
Old 09-28-2009, 06:07 PM
Intermediate Member
 
Posts: 16
Default

Thanks!

Do you have to run it as the zimbra user?

And I am assuming that the 30 is for the number of days back the person has logged in. So for querying only the people that have never logged in you would pass a 0?

Last edited by msonen; 09-28-2009 at 06:28 PM..
Reply With Quote
  #9 (permalink)  
Old 09-29-2009, 11:19 AM
Intermediate Member
 
Posts: 16
Default

Nevermind. Thanks I got it working.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.