[ol]otime="16:35:01" #定时时间
ctime=`date +"%H:%M:%S"` #当前时间
step=5 #消息间隔步长
echo "The timing time is : "${otime}, "the current time is : "${ctime} " the step is "${step}
while [[ "${ctime}" != "${otime}" ]]
do
sleep 1
ctime=`date +"%H:%M:%S"`
mi=`date +"%M"` #分钟
sec=`date +"%S"` #秒
rs=`expr ${mi} % ${step}` #分钟与间隔取余
if [ ${rs} = 0 ] && [ ${sec} = "01" ]
then
echo -e "current time is "`date +"%H:%M:%S"` " wait a few minutes."
else
echo "sleep 1 second : "`date +"%H:%M:%S"` " -- M: ${mi} S: ${sec} not !"
fi
done
echo "ctime:"${ctime} " eq otime:"${otime}[/ol]复制代码