简体   繁体   中英

Python script does not work under crontab

I have a very basic python script to run through crontab for every minutes.

The Script

filed = open('test.txt','a')

Crontab

* * * * * /to path the file/job.py

It should work, but i have not been able to see the results. So, what could be the problem ?

You need to open text.txt using an absolute path; the crondaemon may well be using different path from what you expect:

filed = open('/home/john/Desktop/test.txt','a')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM