Crontab not executing a Python script?

前端 未结 15 1574
囚心锁ツ
囚心锁ツ 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:50

    It is possible that the script does not start because it cannot locate the python interpreter. Crontab environment may be very different from the shell environment which you are using. The search paths may be differ significantly. Also, you test your script by starting the python interpreter explicitly while you expect the crontab to only start the script. I put this line at the top of my python scripts:

    \#!/bin/env python

    This line will help locate the interpreter regardless of which directory it is installed in as long as it is in the search path.

提交回复
热议问题