Y
Y
ywitodenasuby2019-12-28 00:23:55
Task Schedulers
ywitodenasuby, 2019-12-28 00:23:55

Cron on hosting stops for some reason?

If you run the script through the terminal, then it will work to the end, and if through Cron, it will be interrupted. What to do? Maybe there are some settings on the hosting?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
Lev Zabudkin, 2019-12-28
@zabudkin

Contact the hoster, because any task (as a rule) is not limited in execution time. For example php, by default it is not limited to execution (cli), so I advise you to contact the hoster.

V
Vadim Priluzkiy, 2019-12-28
@Oxyd

Most likely, the fact is that processes launched from cron and tasks launched from shell have a different context - a different set of system variables ( in cron - much less ).

G
Germanjon, 2019-12-28
@Germanjon

As already answered above, Cron has a different set of system variables.
What can I advise?
1. At a minimum, set all commands that are executed in the script (cp, rm, cat) to full paths (/bin/cp and so on). The full path can be found with the which command.
2. Keep logs. That is, output the result of each command to a file. It will help to debug and understand what is being executed and what is not.

C
CityCat4, 2019-12-28
@CityCat4

I usually came across the fact that if the script is launched by cron, then it suddenly requires almost all commands to prescribe full paths, even such as mkdir for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question