Hi Geert,
             I only saw your reply just now when I checked the archive. I can confirm that I arrived at the same solution myself via http://stackoverflow.com/questions/3287038/cron-and-virtualenv but Thankyou for posting your reply. stackoverflow is a great resource as well as this one.
Many Thanks!

Regards
jamesp

Regards
  Paddy
J P Mullan

On 19 November 2014 at 22:14, James Mullan <jamespamullan@gmail.com> wrote:
Hello,
         I am trying to figure out how to run the cleanup scripts in a cron job. The below works on command line:

 python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 30 -1 -i
pysqlite>=2 egg successfully loaded for sqlite dialect
##########################################

# 2014-11-19 22:07:32 - Handling stuff older than 30 days
# Displaying info only ( --info_only )

Deleted 0 histories
Elapsed time:  0.0684289932251
##########################################

but if I try to do this in a cron job as follows:


55 21 * * * python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 30 -1 -i >> /media/Store/galaxy/galaxy-dist/temp 2>&1

python: can't open file 'scripts/cleanup_datasets/cleanup_datasets.py': [Errno 2] No such file or directory

or if I try to do this :


00 22 * * * python /media/Store/galaxy/galaxy-dist/scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 30 -1 -i >> /media/Store/galaxy/galaxy-dist/temp 2>&1

Traceback (most recent call last):
  File "/media/Store/galaxy/galaxy-dist/scripts/cleanup_datasets/cleanup_datasets.py", line 13, in <module>
    from galaxy import eggs
ImportError: No module named galaxy


Note that I am directing the output to a file only to try to find out why it's not working.


Is this a problem with environment?

Any suggestions what to try would be much appreciated.

Regards
 
​James​

J P Mullan