Question:
Why aren't console cron commands executed on CentOs 7?
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
crontab file
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
01 * * * * /var/www/main/www/public_html/yii replication/get-entities >> /vat/log/console-app.log 2>&1
sudo systemctl start crond.service
$ sudo systemctl status crond.service
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) since Вт 2017-04-25 12:33:18 MSK; 27s ago
Main PID: 7326 (crond)
CGroup: /system.slice/crond.service
└─7326 /usr/sbin/crond -n
апр 25 12:33:18 luna.server systemd[1]: Started Command Scheduler.
апр 25 12:33:18 luna.server systemd[1]: Starting Command Scheduler...
апр 25 12:33:18 luna.server crond[7326]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 70% if used.)
апр 25 12:33:18 luna.server crond[7326]: (CRON) INFO (running with inotify support)
апр 25 12:33:18 luna.server crond[7326]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
апр 25 12:33:41 luna.server systemd[1]: Started Command Scheduler.
$ ps -ef | grep cron
227:root 7326 1 0 12:33 ? 00:00:00 /usr/sbin/crond -n
231:puganovs 7408 6174 0 12:38 pts/0 00:00:00 grep --color=auto -in cron
Nothing falls to the console-app.log file. From the console, the yii replication / get-entities command runs without problems. What could be the problem? I tried it like this:
*/1 * * * * root /usr/bin/php /var/www/main/www/public_html/yii replication/get-entities
Answer:
As @etki said, you have a typo in the path name "/vat/log/console-app.log 2> & 1". Correct to "/var/log/console-app.log 2> & 1"