[Tutor] running python program on Linux Virtual Server - Plesk?
Christian Witts
cwitts at compuscan.co.za
Thu Sep 3 08:45:40 CEST 2009
Michael Yang wrote:
> Hi Everyone,
>
> I'm new to programming and to python.
>
> I have a program I want to run on my Media Temple Virtual Server (dv)
> - Linux. which has the latest Plesk 9 virtuozzo installed.
>
> Ultimately I want it to run the program (main.py) on a scheduled
> basis. How do I do this?
>
>
>
> Thanks!
>
> -Mike
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
Are you able to run it as a cron job ? That would be by far the easiest
solution.
crontab -e
syntax when editing is "minute hour dayOfMonth month dayofWeek command"
so you would do
0 0-23 * * * python main.py
which would run your python script every hour every day.
Personally, if you do schedule it like this you would better off calling
a shell script with the cron job and in the shell script listing certain
environment variables you might need and then calling the script. The
job won't be running under your normal user account so you might need to
add them.
--
Kind Regards,
Christian Witts
More information about the Tutor
mailing list