Solved! Go to Solution.
You'll need to create a reference file with touch for 20 minutes ago. (Or use gnu find, -mmin +20.)
The problem with 20 minutes ago is that you need to do date arithmetic on touch. If now is 16:00, then the reference file would be:
touch 02091540 ref_file
You can also solve the reference file issue by creating it manually the first time then just use your sleep or cron to remember 20 minutes ago:
touch ref_file_new # for next time
for fstr in $(find /odsdata1/archive/ods_* -type f ! -newer ref_file); do
done
mv ref_file_new ref_file
sleep $(( 20 * 60 ))
I suppose you could put the touch at the bottom if the find and mv doesn't take too long.
>"find -mmin" command. Can you please edit my script to add this portion?
Unless you install GNU find, you can't. HP-UX's find only has the standard day granularity with -mtime. If you don't want to use GNU, you will have to use a reference file or use ahsan's perl solution.
>you can make it 1 hour.
That is still 1/24 too small. :-)
>JRF: The "1/96" is one 15-minute period
You might want to use an expression so you don't have to explain it:
15 / (24 * 60)