Domanda

I am in the process of writing a Python script, that I will want to run automatically, say every evening.

I intend to run it from server, partly because I have one so I may as well as it's always on, but also to learn how to do it, and this may at some point end up as a more full 'web app' - for now though it's just reading some data, and sending an email.

Solutions I've come across have ranged from cgi, wsgi, to 'microframeworks'. I'm also loosely aware of Django (is that a 'microframework'?).

I don't know which I should be using for this simple task - I don't know if it even needs anything, can I just store it on the server and schedule it to run via cpanel?

È stato utile?

Soluzione

If you are running on a *nix server and your user account has permission, use cron.

Edit your crontab using $ crontab -e

An entry along these lines will run your job at midnight each night:

0 0 * * * python /path/to/myscript.py

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top