Quote:
Originally Posted by
sniper57
Thanks for the replies.
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)
then use
lastrun=`ls -l --time-style='full-iso' add | awk '{s=$6$7;gsub(/[:-]/,"",s);print substr(s,1,14)}' `
now=$(echo `date +"%Y%m%d%H%M%S"`)
then compare the above two variable
if [[ $now < $lastrun ]]; then
echo "Greater"
else
echo "Lower"
fi
cheers,
Devaraj Takhellambam