Cronjob doesn't work in Jail?

Greetings.

I have;
Code:
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
20 12 * * * /root/myscr.sh (Trying to run every day at 12:20 PM - If I made it correctly here)
in my "crontab -e" screen, however myscr.sh file doesn't get executed.

Any clue on this?
 
I'm willing to bet the script does get executed (easily verified by looking at /var/log/cron) but the script itself fails, most likely cause is the limited PATH of a cronjob.
 
I'm willing to bet the script does get executed (easily verified by looking at /var/log/cron) but the script itself fails, most likely cause is the limited PATH of a cronjob.
If you dump the ENV variables you can simulate in a accurate way the cron execution:
crontab -e
*/1 * * * * env > /tmp/env
grep -e SHELL -e PATH -e HOME -e LOGNAME /tmp/env
env -i SHELL=/bin/sh PATH= HOME= LOGNAME= PATH_TO_SCRIPT
You will see if something is failing
 
  • Like
Reactions: mro
Back
Top