From: Brent D. <br...@de...> - 2001-01-12 18:50:39
|
> > If I shut down and restart MH and then issue the voice command that > > calls kids_bedtime(), it works fine and, after 5 minutes, > > kids_bedtime2() is executed as it should be! However, if MH has been > > running all day and gets to the timed event that kicks this function > > off, I get error messages in the log about not being able to find the > > subroutine. > > I tried to re-create the problem here, but no luck so far. I am > running the > attached code, but it worked fine after 10 hours. I'll try it again > tonight, but I'd be surprized if it failed. Whats weird is that I have a similar setup that runs in the morning that seems to be ok. I do have cron job and script that restarts viavoice and MH every morning at 1:00am, so MH will only have been running for 6 hours or so when this one kicks off, instead of the 19+ hours of the kids_bedtime routines. > I CAN see a problem, however, if I do a mh reload or restart > during 5 minute > timer period. Thats because the subroutine reference we get with I've never had luck with reloading code via any MH method. Instead I came up with a shell script that kills MH and viavoice processes initscript-style (mhrun.sh [start stop restart). > \&kids_bedtime2 changes on a reload/restart. To avoid this, you can use > this instead: > > set $kids_bedtime_timer 1, '&kids_bedtime2'; > > Maybe that will fix your problem as well. > > Bruce Okay, I've made those changes and restarted, we'll see how it goes tonight. I was trying to come up with a solution like this (using a "soft" reference instead of a "hard", if I'm reading that correctly), but wasn't quite sure of the semantics for doing this. Thanks, Brent > > ---------- > > $kids_bedtime_timer = new Timer; > > $test_timer = new Voice_Cmd 'Test timer'; > > &kids_bedtime if said $test_timer; > > sub kids_bedtime2 { > print_log "Got to bedtime2"; > unset $kids_bedtime_timer; > } > > sub kids_bedtime { > print_log "Starting timer test"; > set $kids_bedtime_timer 1, \&kids_bedtime2; > } > |