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

Discussion in 'Python' started by Pieter Claerhout, Jan 13, 2004.

  1. 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 [mailto:]
    Sent: 13 January 2004 15:24
    To:
    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
     
    Pieter Claerhout, Jan 13, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack Wright
    Replies:
    2
    Views:
    7,002
    yeswanthi
    May 28, 2007
  2. Bart Nessux
    Replies:
    5
    Views:
    377
    Valentino Volonghi aka Dialtone
    Jan 16, 2004
  3. vasanth kumar
    Replies:
    1
    Views:
    131
    Evertjan.
    Oct 3, 2004
  4. Paul
    Replies:
    2
    Views:
    174
  5. K
    Replies:
    4
    Views:
    334
Loading...

Share This Page