Question about invoking a python script from cron ...

Steve Juranich sjuranic at condor.ee.washington.edu
Fri Sep 29 01:27:38 EDT 2000


On Thu, 28 Sep 2000, Adam Pearse wrote:

> Hi, I've been trying to get a python script to run from cron. This script
> runs without errors if I invoke it interactively but when the scheduled time
> comes up it does not appear to run. I get no errors in the cron.log. This is
> the shell script called CXAudit I use (can be found in the  /etc/cron.weekly
> directory).
> 
> 
> #! /bin/sh
> /usr/bin/python /etc/cron.weekly/CXAudit.py
> 
> That's it, not very difficult tough stuff. Basically this python script
> parses a file owned by user squid (yes, from the squid proxy). Any ideas why
> this won't work?
> 

What kind of errors is cron giving you (you should be getting email about
it)?

Just a random thought... I've tried running scripts before in cron and it
gave me errors about not being able to find certain things.  What I was
trying to do was not a huge deal, so I didn't worry about it, but you might
try adding a couple of lines before your script like:

. /etc/profile # or wherever your system dotfiles are.
. /home/me/.profile # substitue "me" with your user name.

I'd be interested to know if that works.

HTH

----------------------------------------------------------------------
Stephen W. Juranich                         sjuranic at ee.washington.edu
Electrical Engineering         http://students.washington.edu/sjuranic
University of Washington             http://rcs.ee.washington.edu/ssli





More information about the Python-list mailing list