crontab下的cron工作不工作

时间:2022-09-15 16:47:36

I have added the following entry:

我添加了以下条目:

*/1 * * * * /home/coddict/myapp-dev/spoolemailsender

and the shell that I am trying to execute (the file spoolemailsender) has the following:

我要执行的shell(文件spoolemailsender)有以下内容:

#!/bin/sh

php app/console swiftmailer:spool:send --env=dev

Why isn't this script running every 1 minute? Do I need another command to get this cron job running?

为什么这个脚本不是每一分钟运行一次?我是否需要另一个命令来运行cron作业?

1 个解决方案

#1


2  

You forgot to put user to execute cron job:

忘记让用户执行cron作业:

*/1 * * * * root /home/coddict/myapp-dev/./spoolemailsender

or

*/1 * * * * root sh /home/coddict/myapp-dev/spoolemailsender

root for example.
Assuming spoolemailsender is executable script and you don't need to do ./spoolemailsender or sh spoolemailsender

根为例。假设spoolemailsender是可执行的脚本,您不需要做。/spoolemailsender或sh spoolemailsender。

#1


2  

You forgot to put user to execute cron job:

忘记让用户执行cron作业:

*/1 * * * * root /home/coddict/myapp-dev/./spoolemailsender

or

*/1 * * * * root sh /home/coddict/myapp-dev/spoolemailsender

root for example.
Assuming spoolemailsender is executable script and you don't need to do ./spoolemailsender or sh spoolemailsender

根为例。假设spoolemailsender是可执行的脚本,您不需要做。/spoolemailsender或sh spoolemailsender。