Crontab not executing a Python script?

前端 未结 15 1533
囚心锁ツ
囚心锁ツ 2020-11-29 20:42

My python script is not running under my crontab.

I have placed this in the python script at the top:

#!/usr/bin/python

I hav

15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 20:51

    While the answers here clearly delineate the problem and solution, I wanted to add another answer which helped me.

    If your python script is calling a database, then be sure you can connect to the db properly within the cron env (to identify the cron env--> https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work). I had a file that would run from the shell, but not as a crontab unless I connected to the database as root from within the python script.

提交回复
热议问题