F
F
fremsisRus2017-12-30 09:57:04
linux
fremsisRus, 2017-12-30 09:57:04

How to properly set up cron to execute php script?

I'm trying to add a php script, via crontab -e (script execution every 3 hours)

* 3 * * * /usr/bin/php /var/www/site.ru/public_html/index.php

through the browser it works without problems, there are no errors, it also runs through the console without problems, but nothing through cron. Here are the logs /var/log/cron.log:

Dec 30 09:31:22 server-107 crontab[868]: (ftpsite) BEGIN EDIT (ftpsite)
Dec 30 09:32:22 server-107 crontab[899]: (ftpsite) LIST (ftpsite)
Dec 30 09:32 :34 server-107 crontab[900]: (ftpsite) BEGIN EDIT (ftpsite)
Dec 30 09:32:53 server-107 crontab[900]: (ftpsite) END EDIT (ftpsite)
Dec 30 09:32:57 server- 107 crontab[911]: (ftpsite) LIST (ftpsite)
Dec 30 09:33:28 server-107 crontab[912]: (ftpsite) DELETE (ftpsite)
Dec 30 09:33:33 server-107 crontab[913]: (ftpsite) BEGIN EDIT (ftpsite)
Dec 30 09:34:19 server-107 crontab[913]: (ftpsite) REPLACE (ftpsite)
Dec 30 09:34:19 server-107 crontab[913]: (ftpsite) END EDIT (ftpsite)
Dec 30 09:34:27 server-107 crontab[924]: (ftpsite) LIST (ftpsite)
Dec 30 09:39:01 server-107 CRON[926]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/ lib/php/sessionclean; fi)
Dec 30 08:27:22 server-107 systemd-timesyncd[371]: Synchronized to time server 91.206.16.3:123 (0.debian.pool.ntp.org).
Dec 30 08:31:55 server-107 crontab[600]: (ftpsite) BEGIN EDIT (ftpsite)
Dec 30 08:32:05 server-107 crontab[600]: (ftpsite) END EDIT (ftpsite)
Dec 30 08: 39:01 server-107 CRON[653]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/ sessionclean; fi)
Dec 30 09:09:01 server-107 CRON[713]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Dec 30 09:17:01 server-107 CRON[803]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Dec 30 09:31:22 server-107 crontab[868] : (ftpsite) BEGIN EDIT (ftpsite)
Dec 30 09:32:22 server-107 crontab[899]: (ftpsite) LIST (ftpsite)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
egor_nullptr, 2017-12-30
@egor_nullptr

* 3 * * *- this is not every three hours, but 60 times a day, every minute from 03:00 to 03:59.
0 */3 * * *- like this every three hours.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question