2016-11-10 134 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

谢谢您的回答,但现在第二份工作是不是在所有运行。 –