Neal Sidd
Neal Sidd

Reputation: 39

Deploying a Python Script on a Server (CentOS): Where to start?

I'm new to Python (relatively new to programing in general) and I have created a small python script that scrape some data off of a site once a week and stores it to a local database (I'm trying to do some statistical analysis on downloaded music). I've tested it on my Mac and would like to put it up onto my server (VPS with WiredTree running CentOS 5), but I have no idea where to start.

I tried Googling for it, but apparently I'm using the wrong terms as "deploying" means to create an executable file. The only thing that seems to make sense is to set it up inside Django, but I think that might be overkill. I don't know...

EDIT: More clarity

Upvotes: 1

Views: 933

Answers (3)

summea
summea

Reputation: 7583

Sounds like a job for Cron?

Cron is a scheduler that provides a way to run certain scripts (apps, etc.) at certain times.

Here is a short tutorial that explains how to set up cron. See this for more general cron information.

Edit:

Also, since you are using CentOS: if you end up having issues with your script later on... it could partly be caused by SELinux. There are ways to disable SELinux on your server (if you have enough access permissions.) But... there are arguments against disabling SELinux, as well.

Upvotes: 0

monkut
monkut

Reputation: 43830

  1. Copy script to server

  2. test script manually on server

  3. set cron, "crontab -e" to a value that will test it soon

  4. once you've debugged issues set cron to the appropriate time.

Upvotes: 1

Andrew Clark
Andrew Clark

Reputation: 208465

You should look into cron for this, which will allow you to schedule the execution of your Python script.

If you aren't sure how to make your Python script executable, add a shebang to the top of the script, and then add execute permissions to the script using chmod.

Upvotes: 1

Related Questions