2016-01-23 252 views
0

之間,我需要在crontab中上午8:45每天上午9:50之間每分鐘運行bash腳本。執行一個cronjob每分鐘2次

代碼

45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 8 * * * /home/pull.sh > /home/logs/pull.log 2>&1 
00/50 9 * * * /home/pull.sh > home/logs/pull.log 2>&1 

這是正確的和/或最有效的方式做到這一點?

+0

爲您所標記該W既'linux'和'unix',我想提的是舊版'unix'系統不支持範圍倍以下給出答案。在任何情況下,唯一的效率增益是crontab項中的字符數量較少。無限小的收益; - /更好地看待其他問題。祝你好運。 – shellter

回答

1

試試這個:

45-59/1 8 * * * /home/pull.sh > /home/pull.log 2>&1 
00-50/1 9 * * * /home/pull.sh > /home/pull.log 2>&1 
0

http://www.nncron.ru/help/EN/working/cron-format.htm

據該網站,你可以做這樣的事情:

45-59 8 * * * /home/pull.sh > /home/logs/pull.log 2>&1 

我不能確定你正在尋找這一行做什麼:

00/50 9 * * * /home/pull.sh > home/logs/pull.log 2>&1 

我其實不知道會做什麼。