安排一个python脚本在webserver上运行
我正在编写一个Python脚本,我会想每天晚上自动运行。
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.
解决方案我'我们遇到了,从cgi,wsgi到微型薄膜。我也很松散地意识到Django(这是一个微型薄膜?)。
Solutions I've come across have ranged from cgi, wsgi, to 'microframeworks'. I'm also loosely aware of Django (is that a 'microframework'?).
我不知道我应该用这个简单的任务 - 我不知道如果它甚至需要任何东西,我可以把它存储在服务器上如果您运行在* nix服务器上并且您的用户帐户有权限,请使用
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?
一个href =http://en.wikipedia.org/wiki/Cron =nofollow> cron 。
If you are running on a *nix server and your user account has permission, use cron.
使用 $ crontab -e
这些行的条目将在每天晚上的午夜运行您的工作:
An entry along these lines will run your job at midnight each night:
0 0 * * * python /path/to/myscript.py