Answer the question
In order to leave comments, you need to log in
Why does cron run 2 times?
Good day!
There is a Cron job wget -q -O - my-site.ru/index.php?route=common/task/doSome > /dev/null 2>&1
which should run every night at 01:15. Judging by the cron logs, it starts at 01:15:01 and runs 1 time. But the task duplicates the data and judging by my logs, the task starts at 01:15:01 and then at 01:15:02. The job executes several queries against the database and takes a little less than a second to complete.
What could be the problem? Why is data duplicated?
I'm attaching the cron logs below.
Mar 6 01:14:01 vm2002283119 CROND[8605]: (root) CMD (/usr/local/mgr5/sbin/cron-ispmgr sbin/mgrctl -m ispmgr periodic >/dev/null 2>&1)
Mar 6 01: 14:01 vm2002283119 CROND[8606]: (root) CMD ( /opt/php71/bin/php -c /usr/local/mgr5/addon/revisium_antivirus/php.ini /usr/local/mgr5/addon/revisium_antivirus/services /queue.php >> /usr/local/mgr5/var/raisp_data/log/raisp_queue.log 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[8630]: (root) CMD ( /opt/php71/bin /php -c /usr/local/mgr5/addon/revisium_antivirus/php.ini /usr/local/mgr5/addon/revisium_antivirus/services/email.php >> /usr/local/mgr5/var/raisp_data/log/email .log 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[8635]: (root) CMD (/usr/local/mgr5/sbin/cron-ispmgr sbin/mgrctl -m ispmgr problems.autosolve >/dev/null 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[8631]: (root) CMD (/usr/local/mgr5/sbin/cron-core sbin/mgrctl -m core sysinfostat >/dev/null 2>&1)
Mar 6 01: 15:01 vm2002283119 CROND[8633]: (root) CMD (/usr/local/mgr5/sbin/cron-ispmgr sbin/mgrctl -m ispmgr periodic >/dev/null 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[8632]: (root) CMD (/usr/local/mgr5/sbin/cron-core sbin/mgrctl -m core problems.autosolve >/dev/null 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[ 8634]: (root) CMD (wget -q -O - my-site.ru/index.php?route=common/task/doSome > /dev/null 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[8636]: (root) CMD ( /opt/php71/bin/php -c /usr/local/mgr5/addon/revisium_antivirus/php.ini /usr/local/mgr5/addon /revisium_antivirus/services/queue.php >> /usr/local/mgr5/var/raisp_data/log/raisp_queue.log 2>&1)
Mar 6 01:15:01 vm2002283119 CROND[8637]: (root) CMD (/usr /local/mgr5/sbin/cron-ispmgr addon/srvmon >/dev/null 2>&1)
Mar 6 01:16:01 vm2002283119 CROND[8672]: (root) CMD ( /opt/php71/bin/php -c /usr/local/mgr5/addon/revisium_antivirus/php.ini /usr/local/mgr5/addon/revisium_antivirus/services/queue.php >> /usr/local/mgr5/var/raisp_data/log/raisp_queue.log 2> &1)
Mar 6 01:16:01 vm2002283119 CROND[8673]: (root) CMD (/usr/local/mgr5/sbin/cron-ispmgr sbin/mgrctl -m ispmgr periodic >/dev/null 2>&one)
Mar 6 01:17:01 vm2002283119 CROND[8688]: (root) CMD (/usr/local/mgr5/sbin/cron-ispmgr sbin/mgrctl -m ispmgr periodic >/dev/null 2>&1)
Answer the question
In order to leave comments, you need to log in
my-site.ru/index.php?route=common/task/doSome
and judging by my logs, the task starts at 01:15:01 and then at 01:15:02.
Firstly, in vain you run such tasks and from under the root itself.
Secondly, according to the cron logs, the task with wget is launched one (1) time.
If it is launched twice, it means somewhere someone is launching it again.
Somewhere in some PHP script?
And third, it's worth enclosing the URL for wget in quotes:
wget -q -O - "my-site.ru/index.php?route=common/task/doSome" > /dev/null 2>&1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question