A
A
Alexey Kos2015-12-21 17:54:39
PHP
Alexey Kos, 2015-12-21 17:54:39

Why is cron task not starting?

There are 2 cron tasks registered in /etc/crontab, one of the cron tasks works successfully, and the second does not start at all.
I thought that the task was not working, but it was not noticeable, I decided to check it. I made it so that the script that should be executed writes an inscription to the file. Checked just in case. I ran the script manually, everything works.
The next day, the file was not written to, i.e. the task was not completed.
Why is it not executed?
The first task fails, but the second one succeeds.
The output of the crontab -l command is:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
[email protected]
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

0 3 * * *       /home/my/cron.php
0 12 * * *      /home/my/cronmail.php

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton B, 2015-12-21
@bigton

It's strange to me that you even have the second one running.
After all, you only write the path to the file, without saying what to do with it.
For example, instead of /home/my/cron.php, you need to write php /home/my/cron.php or wget site/cron.php
If you have bash scripts at the addresses, then check the permissions on the files.

A
Andrey Burov, 2015-12-21
@BuriK666

execute flag set
chmod +x /home/my/cron.php

R
romy4, 2015-12-21
@romy4

cron is run by whom?
is there a right to run the user from which the cron is run?
any errors should be logged 2>&1 > /path/to/log

M
mureevms, 2015-12-21
@mureevms

username where?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question