FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Python automation [SOLVED]





pluto
Hello,

I'm new to Python and programming in general, but created a web page that combines Python and HTML, allowing users to enter a name. The program is currently set up to save the name in a .txt file, then I ftp the .txt file to my local PC and run the Python program; the outcome is a new .txt file (adding the new names to a list of previously entered names) which I then ftp back to the server to be displayed on the web page. Sound like a lot of work, right?

What I want to do is automate this process so the Python program runs on the server. Ideally, I would like to program to run when a new name is entered, but I think this may be a bit of a challenge for a newbie like me. Therefore, an easier solution is if the program ran every day at a specific time, this is where I get lost.

Can someone guide me as to the best way to accomplish this task?

Thanks for your help!
MrBlueSky
You can use a cronjob. With a cronjob you start a certain task automatically every day (or hour or week).

Read about it and how you set up your cronjob using directadmin at frihost here: http://www.site-helper.com/misc.html#cron
deepak
cronjob dude
pluto
Thank you for your help. I read the documentatioin on how to set up cronjob, but being new to all this I'm don't know the command I need to enter to execute the program. I have the program in the .cgi bin, should it be somewhere else? I tried entering python /path to script, but this did not do it. Any help is much appreciated.

Thank you.
MrBlueSky
- You must make sure the python script is executable (chmod it to 755)
- It must begin with something like #!/usr/bin/python so that the system nows it's python
- Then you use the path to the script when creating the cronjob, for example if it is in your cgi-bin:

Quote:

/home/yourname/domains/yourname.frih.net/public_html/cgi-bin/yourscript


Where you replace yourname and yourscript with the correct names.
pluto
Thanks for all the help, everything is working great now!

I was missing the #!/usr/bin/python at the top of the program ( I had this line inside a comment box a few lines down, but it must be the 1st line in the program).

Thanks again for all the help!
Related topics
Monty Python
Python Tutorial
Python
Desktop sidebar
python tutorials
python tutorials
Can one reset the site? (Solved)
Python books
Python Bursts After Trying to Eat Gator
A great website poll....
python support
solved
Facts about India : Proud to be an Indian
PythonChallenge - an Amusing Way to Explore Python
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.