2016-11-10 166 views
0

在我的cron作業文件,我定義了兩個cronjobs:Cron作業運行在同一時間

#Yo1 MAILTO="[email protected]" 
*1****wget -O - -q "http://example.com/cron/test1.php">/dev/null 2>&1 
#Yo1 MAILTO="[email protected]" 
*15****wget -O - -q "http://example.com/cron/test2.php">/dev/null 2>&1 

的PHP文件與不同的主題只是簡單發送郵件。

問題是兩個cronjobs每分鐘都在同一時間運行,但正如您所看到的,我希望它們在不同的時間運行。首先 - 每分鐘,每秒鐘15分鐘。

你能幫我解決這個問題嗎?我無法弄清楚什麼是錯的。

回答

2

您的語法不正確。 請使用下面的代碼

 

#every minute 
* * * * * wget -O - -q "http://example.com/cron/test1.php">/dev/null 2>&1 

#every 15 minutes 
*/15 * * * * wget -O - -q "http://example.com/cron/test2.php">/dev/null 2>&1 

您可以使用網上的crontab發電機像http://www.crontab-generator.org/

0
* * * * * wget -O - -q "http://example.com/cron/test1.php">/dev/null 2>&1 
15 * * * * wget -O - -q "http://example.com/cron/test2.php">/dev/null 2>&1 
+0

謝謝您的回答,但現在第二份工作是不是在所有運行。 –