This tutorial explains how to schedule the count of all users created yesterday(For more information on how to query LDAP to find the count of records in a container, please click here).
To schedule the count of all users created yesterday first connect to the directory server (To create a new connection please see Connecting to a LDAP Server using LDAP Admin Tool)
After successful connection, select the SQL button from the top menu, this will open the sql tab where you can enter the sql statements.
To find the count of all users created yesterday in the container o=stooges enter the following sql statement in the SQL Pane:
SELECT Count (*) FROM o=stooges where (objectClass='person' or objectClass='organizationalPerson' or objectClass='inetOrgPerson' ) and createTimestamp <= CurrentEndofDay -1 days and createTimestamp >=CurrentStartofDay -1 days
subtreescope
also increase the maximum count if you expect more than 1000 records
Now Click the Run button from the top menu or from right click context menu. After successful run a dialog will open showing a total number of records in the container o=stooges.
To schedule this count of records, Click the Export Button and select 'Schedule this export' link (For count (*) query you can select any type of export, the results will only be written to the log file and emailed to you if you select the email option)
If you are using Simple Authentication, make sure that the save password box is checked and the credentials are admin credentials or credentials with password set to never expire otherwise task will fail when the credentials will expire. Click Next to continue.
For count (*) you can skip the write to a file page as the count will only be written to logs and will be send in email, so uncheck the write to a file check box or just leave it to default.
|
Check the 'Send Email' box if you want to send email after the scheduled process is over. Fill in the necessary information and click Next.
|
Enter a unique name for this task, select the text after header from the text box, open a command/terminal window, paste the text and click enter. Once you are satisfied with the results, create a scheduler task using windows scheduler or Linux cron. Click Finish to save this task.
|
See Also:
How to schedule task using Windows scheduler
How to schedule task using Linux cron
Query LDAP Using Select Statements