John Smith
John Smith

Reputation: 2738

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 ?

Upvotes: 1

Views: 212

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1125078

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')

Upvotes: 6

Related Questions