Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Make a function call itself after set amount of time

Reply
Thread Tools

RE: Make a function call itself after set amount of time

 
 
Pieter Claerhout
Guest
Posts: n/a
 
      01-13-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 |
| www.creo.com

IMAGINE CREATE BELIEVE(tm)


-----Original Message-----
From: Bart Nessux [private.php?do=newpm&u=]
Sent: 13 January 2004 15:24
To: python-
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Would I make text pop up a certain amount of time after theprevious action K Java 4 10-18-2012 01:49 AM
How can I make an FXRuby window stay open for a set amount of time? Paul Ruby 2 03-05-2007 09:17 PM
Trixbox - How to set a trun to register after x amount of seconds RH UK VOIP 3 09-05-2006 06:44 PM
How to run script after specified amount of time after login vasanth kumar ASP General 1 10-03-2004 07:34 AM
Make a function call itself after set amount of time Bart Nessux Python 5 01-16-2004 11:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57