Hi -
I need to run a script via cron which will do some ldapsearches. One of the search parameters will be modifytimestamp.
I need to have some way of storing the timestamp of the last time the script ran, and then retrieving that timestamp to use in the ldapsearch command (i.e. modifytimestamp >= retrieved_ts) for when the script next runs.
Any suggestions please? I guess I could "touch" a file as a marker before and after executing the ldapsearch but I am not sure how to get the timestamp of the file into the ldapsearch query.
Cheers
Unfortunately I don't have the stat command available in my AIX envt.
The timestamp needs to be in this format : 20090425000000
so yyyymmddhhmmss
Maybe it would be easier to just write/append the timestamp to a file and read the last entry from that? I just feel there has to be a neater way of doing this!
How do I get the timestamp in the format I want from something like :
ls -l $FILE | awk '{sub(/:/,"",$8);print $8}' ?
what you can possibly do is ..in you ldap script, before it completes successfully, touch the logfile so tht the file will have the latest timestamp (you can write sme msg to the logfile)