2013-05-28 69 views
0
if [ $FILE_SIZE -ge 5000000000 and $FILE_SIZE -le 10000000000 ] 

then 

cp $s/* $W 

else 

#Here I need to wait the script for 10 minutes and re-run the if condition again 

echo "file $myfile is out of Limit" 

fi 
+0

在while(condition)中写入sleep 10分钟 – Kent

回答

1

你可以使用sleep等待10分钟,像这样:

while true ; do 
    if [ "$FILE_SIZE" -ge 5000000000 -a "$FILE_SIZE" -le 10000000000 ] ; then ; break ; fi 
    echo "file $myfile is out of Limit" 
    sleep 600 
done 

cp $s/* $W 
2

您可以使用at从脚本内重新安排脚本如果执行失败。在else块中,加入如下内容:

at now + 10 minutes << END 
./$0 
END