0

This question already has an answer here:

I have a crontab under the root user (sudo crontab -e):

*/20 * * * * python3 /opt/ninja/python/db_alter/db_alter.py

As far as I can tell it should execute every 20 minutes, however when I am checking for a created log file, nothing exists. I can run this command from the directory (or any other directory) as root and it works just fine.

I am running this on Ubuntu 16.04 as an Amazon S3 instance.

What would be causing this problem?

EDIT:

Not a duplicate. This is not due to pathing for cron. I've tested changing that. This is broken for some other reason.

marked as duplicate by Fox, mdpc, Rui F Ribeiro, Philippos, Romeo Ninov Jan 16 '18 at 7:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    PATH being different under crond. This question seems a regular one here. – Rui F Ribeiro Jan 15 '18 at 20:14
  • Interesting. Do you have a link to another question with a solution to this problem? – Andrew Alexander Jan 15 '18 at 20:14
  • 2
    Use full path to python and make sure your script is executable. – fugitive Jan 15 '18 at 20:16
  • @zee not in root's own crontab, no. See this answer, unix.stackexchange.com/a/143843/100397 – roaima Jan 15 '18 at 21:22
  • 1
    I've added that important information to your question for others to see. In the meantime, add >/root/cron.log 2>&1 to the end of your cron entry and see what errors you capture. – roaima Jan 15 '18 at 21:32

Browse other questions tagged or ask your own question.