2017-08-03 78 views
0

我使用solaris,我需要找到超过12小时的文件。 在solaris中,没有-mmin功能。所以,我所做的是:C-shell:找到12小时以上的文件

set timer = "/admin/timer.txt" 
echo date > $timer 

find . -type ! newer $timer 

但是这只工作,我设置脚本每12小时运行一次。 事情是我需要运行脚本每1小时,但我找不到方法如何做到这一点。 有什么建议吗?

+0

您可以将脚本变成cron作业吗? – Stedy

+0

是的...我已经尝试将它设置在cronjob ..我发布的只是脚本的一部分。 – larrey

+0

对不起,我输错了..脚本应每隔12小时运行一个小时 – larrey

回答

0

您可以调用shell函数来执行测试。例如:

now=$(perl -e 'print time') 
find . -exec sh -c 'expr $1 - $(stat -f %m "$2") \<43200> /dev/null' _ $now {} \; -print