I have an automated script - I mean, it runs every 10 minutes by a cronjob. The weird thing is: The file is always found and runs through it when I start the script by hand. But it gives me a lot of troubles when it runs by cron job.
these are the rights of the files:
-rw-r--r-- 1 dataloader users 181 Dec 19 12:37 Foo.after -rwxr-xr-x 1 dataloader users 26098 Feb 16 20:56 loader.py
this is an abstract of loader.py where it checks for Foo.after:
if os.path.exists(self.customer+'.after'):
print 'customer file exists'
f = open(self.customer+'.after')
The cronjob is not executing in the same directory/environment as the script.
You can address this by adjusting your cronjob:
* * * * * cd /home/yourdir; ./loader.py
OR
* * * * * /home/mc/dotasks.sh
dotasks.sh contains:
cd /home/yourdir
./loader.py
#anything else you need to do
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