以下方法將每20秒執行一次
1.編輯crontab
crontab-e
*****/bin/date>>/tmp/da
*****sleep20;/bin/date>>/tmp/da
*****sleep40;/bin/date>>/tmp/da
2.檢查結果
tail-f/tmp/da
ThuOct3115:02:21CST2013
tail:/tmp/da:filetruncated
ThuOct3115:02:41CST2013
tail:/tmp/da:filetruncated
ThuOct3115:03:21CST2013
編寫腳本
[[email protected]]#viunison.sh
whiletrue;do
echo`date`>>/tmp/da
sleep3
done
之後後臺運行腳本每隔三秒執行一次nohupshunison.sh&