需要用到一个Shell脚本,用于对比文件修改时间与现行时间的差值,默认300秒,5分钟
#!/bin/bash
timestamp=$(date +%s)
filetimestamp=$(stat -c %Y filename)
#echo $timestamp
#echo $filetimestamp
#echo $[$timestamp - $filetimestamp]
if [ $[$timestamp - $filetimestamp] -lt 300 ];
then
command
else
command
fi
本文著作权归作者 [ 大白蚁 ] 享有,未经作者书面授权,禁止转载,封面图片来源于 [ 互联网 ] ,本文仅供个人学习、研究和欣赏使用。如有异议,请联系博主及时处理。