Re: add a forever process in agent

Robert Story <[email protected]>
Newsgroups gmane.network.net-snmp.user
Organization Net-SNMP
Message-ID <20050923105938.7d8dc777@aud>
On Thu, 22 Sep 2005 12:18:04 +0100 Dave wrote:
DS> On Thu, 2005-09-22 at 18:36 +0800, Jim Su wrote:
DS> >  I want the process to be executed exactly on the
DS> >  0, 5, 10, 15 .. 55 minutes on the hour.
DS> 
DS> In the 'init_ABCTable' routine, calculate how long
DS> until the next 5-minute mark, and register a one-off
DS> alarm to fire then.   That will trigger an alarm
DS> callback routine 'init_ABCData' which should:
DS> 
DS>   a) initialise the list data, and
DS>   b) register a repeating alarm to call a
DS>      different callback routine ('load_ABCData')
DS> 
DS> This second routine should then be invoked on
DS> the 5-minute marks, as required.

I'm not sure this will work. Looking at the code, it looks like it will run
every 5 minutes from the last time it was run. Thus, each time the agent is
busy when the timer expires, it will drift a little. Eventually, this will add
up. Instead of using the SA_REPEAT, you may want to have the callback function
calculate the time til the next 5 minute mark and reschedule itself. A little
more overhead, but it won't drift.

-- 
NOTE: messages sent directly to me, instead of the lists, will be deleted
      unless they are requests for paid consulting services.

Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>  
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.