How to get cleanup script to run in cron job ?
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
Hi, Try this : 55 21 * * * cd /media/Store/galaxy/galaxy-dist/ && python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 30 -1 -i >> /media/Store/galaxy/galaxy-dist/temp 2>&1 I thought you need to be in the galaxy-dist folder when launching the commands. Best, Geert On 11/19/2014 11:14 PM, James Mullan 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
___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
To search Galaxy mailing lists use the unified search at: http://galaxyproject.org/search/mailinglists/
-- Geert Vandeweyer, Ph.D. Department of Medical Genetics University of Antwerp Prins Boudewijnlaan 43 2650 Edegem Belgium Tel: +32 (0)3 275 97 56 E-mail: geert.vandeweyer@ua.ac.be http://ua.ac.be/cognitivegenetics http://www.linkedin.com/in/geertvandeweyer
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
participants (2)
-
Geert Vandeweyer
-
James Mullan