I have a script in python under Linux that needs to determine the current working directory. The part of program that does this is:
import os
cwd = os.getcwd()
print cwd
When I run the program it gives me the right answer:
/home/johny/LST/CT
But when I run it using crontab, it gives me this:
/home/johny
Even when I put it in deeper folders, the same path results. Does anybody know what can be the problem?
In your crontab file do:
1 0 * * * cd /home/johny/LST/CT; python your_script.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With