Make a function call itself after set amount of time
Pieter Claerhout
Pieter.Claerhout at Creo.com
Tue Jan 13 09:30:27 EST 2004
Bart,
have a look at the TaskKit subpart of WebWare
(http://webware.sourceforge.net/).
You can use it run periodic tasks.
Pieter
Creo
pieter claerhout | product support prinergy | tel: +32 2 352 2511 |
pieter.claerhout at creo.com | www.creo.com
IMAGINE CREATE BELIEVE(tm)
-----Original Message-----
From: Bart Nessux [mailto:bart_nessux at hotmail.com]
Sent: 13 January 2004 15:24
To: python-list at python.org
Subject: Make a function call itself after set amount of time
How do I make a function call itself every 24 hours. Also, is there a
way to start the program automatically w/o depending on the OS functions
like 'Task Scheduler' or 'Start Up Items'... this is on Windows 2k and
xp. Below is an example of what I'm trying to do.
TIA
def ipconfig_email():
from email.MIMEText import MIMEText
import smtplib
import time
import os
u = "user name" #Change This to user's name.
f = "my-email-addy"
t = "my-email-addy"
fp0 = os.popen("ipconfig /all", "r")
fp1 = os.popen("psinfo -d -s", "rb")
msg = MIMEText(fp0.read() + fp1.read())
fp0.close()
fp1.close()
msg["Subject"] = "%s's IPconfig Report" % u
msg["From"] = f
msg["To"] = t
h = "my.smtp.server"
s = smtplib.SMTP(h)
s.sendmail(f, t, msg.as_string())
s.quit()
time.sleep(86400) #24 hour sleep
HOW_DO_I_CALL_THE_FUNCTION_AGAIN?
ipconfig_email()
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list