python time

Nick Stinemates nstinemates at gmail.com
Mon Mar 21 01:01:10 EDT 2011


You should just use cron (or Windows Scheduled Tasks if that's your thing)
for job scheduling, allowing people the flexibility of the environment they
already know.

Nick

On Sun, Mar 20, 2011 at 6:19 PM, ecu_jon <hayesjdno3 at yahoo.com> wrote:

> I'm working on a script that will run all the time. at time specified
> in a config file, will kick-off a backup.
> problem is, its not actually starting the job. the double while loop
> runs, the first comparing date works. the second for hour/min does
> not.
>
> #python file
> import os,string,,time,getpass,ConfigParser
> from datetime import *
> from os.path import join, getsize
> from time import strftime,localtime
>
> config = ConfigParser.ConfigParser()
> config.read("config.ini")
> source = config.get("myvars", "source")
> destination = config.get("myvars", "destination")
> date = config.get("myvars", "date")
> time = config.get("myvars", "time")
> str_time=strftime("%H:%M",localtime())
>
> while datetime.now().weekday() == int(date):
>    while str_time == time:
>        print "do it"
>
> #config file
> #change the time variable to "now"+a min or two to observe
> #this needs to be where ever the actual python script is
> [myvars]
> #only set source if you want it to be different
> source: c:\users\jon
> destination: \\mothera\jon\
> #what day of the week to perform backup?where Monday is 0 and Sunday
> is 6
> date: 6
> #time to start
> time: 21:02
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110320/064ae961/attachment.html>


More information about the Python-list mailing list