WebFaction
Community site: login faq

I have a python script I want to run located here:

/home/jimmynos/webapps/mvp_landing/SoldPrices.py

It needs to run in python 2.7, and run every minute (for testing purposes)

I feel like I've tried every combination to get this to work, Please help.

asked 07 Jun '15, 14:33

James Nos
1315
accept rate: 0%


The following entry in your cron tab should work. The added benefit is you can check the logs.

* * * * * /usr/local/bin/python2.7 /home/jimmynos/webapps/mvp_landing/SoldPrices.py >> $HOME/logs/user/cron.log 2>&1

permanent link

answered 07 Jun '15, 14:37

aaront ♦♦
7664
accept rate: 27%

edited 07 Jun '15, 15:07

Thanks for the quick reply.

I'm getting this issue: "/tmp/crontab.8PYvYa":6: bad minute

Did you know how to fix it.

Thanks

(07 Jun '15, 14:46) James Nos

Try running it without the /1 so the first part should be 5 stars that looks like ' * * *'

(07 Jun '15, 14:54) aaront ♦♦

The code was accepted this time. Do you have to configure any settings to start cron? It doesn't look like its wanting to run anything on the minute. However when I type in python2.7 SoldPrices.py into putty the script works fine.

          • /usr/local/bin/python2.7 /home/jimmynos/webapps/mvp_landing/SoldPrices.py $HOME/logs/user/cron.log 2>&1
(07 Jun '15, 14:59) James Nos

I edited your cron tab to add the ">>" and now it output the error to $HOME/logs/user/cron.log

(07 Jun '15, 15:07) aaront ♦♦

Theres one other schedule in there listed like this:

8,28,48 * * ~/webapps/mvp_landing/apache2/bin/start

          • /usr/local/bin/python2.7 /home/jimmynos/webapps/mvp_landing/SoldPrices.py >> $HOME/logs/user/cron.log 2>&1

Not sure if that helps at all. It was already in there before I started trying to set something up.

(07 Jun '15, 15:08) James Nos

interesting. I'm getting this error:

File "/home/jimmynos/webapps/mvp_landing/SoldPrices.py", line 10, in <module> myfile = open('../mvp_static/templates/SoldPrices.html', 'w') IOError: [Errno 2] No such file or directory: '../mvp_static/templates/SoldPrices.html'

(07 Jun '15, 15:13) James Nos

The first one is created by our django installer to ensure your apache instance is running. It tries to start apache every 20 minutes and if it is already running it simply ends.

(07 Jun '15, 15:14) aaront ♦♦

I think I got it working now.

Had to change the output in the python script to the full path: /home/jimmynos/webapps/mvp_static/templates/SoldPrices.html

Thanks heaps

(07 Jun '15, 15:18) James Nos

Glad to hear that it is working. You are welcome. Please let us know if you need anything else.

(07 Jun '15, 15:19) aaront ♦♦

Really appreciate it.

Thanks again.

(07 Jun '15, 15:43) James Nos
showing 5 of 10 show 5 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×908
×337
×81

question asked: 07 Jun '15, 14:33

question was seen: 2,768 times

last updated: 07 Jun '15, 15:43

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM