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
4

2 回答 2

2

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

at now + 10 minutes << END
./$0
END
于 2013-05-28T14:20:55.033 回答
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
于 2013-05-28T14:15:13.353 回答