R
R
Roman2018-11-23 23:43:51
linux
Roman, 2018-11-23 23:43:51

Why aren't cron jobs running?

Wrote 2 simple scripts: one sends a query to the database, the other just 'echo hello' (for testing)
I added tasks via crontab -e, there is an empty line at the end of the file. Tried adding user std between five * and script path, didn't work. I do not have access to root, if that.
5bf866482e48c239293504.png
Both scripts are executed if run manually. I did it on a screenshot.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Softer, 2018-11-24
@Softer

1. Exhaust in the CODE tag, not a picture
2. SHELL=bin/shbut it should be SHELL=/bin/sh
3. Cron-tasks are performed in a slightly different environment. For example, there is another PATH. It makes sense to specify full paths or write PATH explicitly
4. It's not a bad idea to write ">>/file.log" in the logs, but ">>/file.log 2>&1". This is how it fixes errors.

K
klepiku, 2018-11-24
@klepiku

the record is that this script is at the beginning, the rights of the file are executable?

R
Ruslan Fedoseev, 2018-11-25
@martin74ua

chmod a+x to your scripts.
And then from the shell you run them through the sh script, but for some reason they are not in the crown.
You either wear a cross, or ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question