User Profile

Collapse

Profile Sidebar

Collapse
karxx
karxx
Last Activity: Nov 11 '09, 10:52 AM
Joined: Aug 26 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • karxx
    started a topic drop 0 from hour/minute

    drop 0 from hour/minute

    Hi

    looping within python resources..., I did not find a way to drop the 0 from hours/minutes. In fact I'd like to simply calculate the number of seconds since midnight so I did something like:

    Code:
    int(eval(time.strftime("%H*3600 + %M*60 + %S" , time.localtime())))
    but obviously, that's failing when minute/hour look like 0x. It should work on any OS

    Cheers
    See more | Go to post
    Last edited by bvdet; Aug 27 '09, 04:09 PM. Reason: Add code tags

  • karxx
    replied to scheduler.py : simulate cron
    cannot have the OS instrumenting this, so it should really act as a daemon.
    I will test it right away. cheers
    See more | Go to post

    Leave a comment:


  • karxx
    replied to scheduler.py : simulate cron
    thanks bvdet, looks better.I will test the same with threading now ...

    btw, I noticed that job is finishing after the last events processing. Now how can I instument the script to act as a daemon. I'd like to get the script running forever until schedule list changes but on the other I want to get this list of schedule reloaded everyday. can I do something like :
    ...
    s.run()
    while(1):
    if newday then ...
    See more | Go to post

    Leave a comment:


  • karxx
    started a topic scheduler.py : simulate cron

    scheduler.py : simulate cron

    Hi Gurus,

    Making my first python program and try to mimic a crontab.

    running : 2.6 with sched module

    I need to create a python program which can execute programs at a specific time. so I have a list of schedule such as

    [Start_Time], [Action]
    Monday 25th September 2009 10:00:00, /opt/prgr/run1.sh
    Monday 25th September 2009 11:00:00, /opt/prgr/run2.sh
    Monday 25th September 2009 12:00:00,...
    See more | Go to post
    Last edited by bvdet; Aug 26 '09, 12:46 PM. Reason: Add code tags
No activity results to display
Show More
Working...