I created a script to check XML file available in the folder for more than four hours. If the XML is not processed for more than four hours then I need to send a mail for that I used the below find command but the mmin+240 is not working. Is there is any option to used instead of mmin. Please help on this.
find $OFILEPO/*.xml -mmin+240 -exec ls -ltr {} + | wc -l
when I execute the above find command with mmin got the below error.
**find: bad option -mmin
0
$ uname -a
HP-UX**
I think mmin is AIX command. Please suggest for HP_UX Thanks in Advance
According to the man page hpux 10.20 - find (1), your implementation of find
doesn't support the -mmin
option.
The closest equivalent would be -mtime
-mtime n True if the file has been modified in n days.
Similar questions (Find files modified within one hour in HP-UX, how to find files modified in the last hour?) suggest creating a "reference" file with touch -mt $time
and using find -newer
.
Quoting the second link, you could do:
Create a temp file using the 'touch' command, such that the modification time is one hour in the past. For example:
# date +%m%d%H%m 06261006 # touch -mt 06260906 /tmp/tdate # ll /tmp/tdate -rw-r--r-- 1 root root 0 Jun 26 09:06 /tmp/tdate
Then run 'find' with the '-newer' switch, taking advantage of this file:
find /mnt -newer /tmp/tdate -type f -xdev -exec ll {} \;