Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.scheduler2.thread.script
<<Changes <<8/18/08; 11:09:57 AM by DW <<Status message displays only if user.scheduler2.prefs.flMessages is true. <<6/11/08; 8:50:33 AM by DW <<Status message now displays last URL accessed. <<5/29/08; 1:00:20 PM by DW <<Call inetd.isDaemonRunning in a try, it can error (Invalid stream) as we're starting up. <<5/25/08; 12:11:27 PM by DW <<Created. loop { local (day, month, year, hour, minute, second, now = clock.now ()); scheduler2.init (); user.scheduler2.stats.ctLoops++; <<user.scheduler2.stats.whenLastLoop = clock.now () date.get (now, @day, @month, @year, @hour, @minute, @second); if second == 0 { local (adrscript); for adrscript in @user.scheduler2.everyMinute { thread.callscript (@scheduler2.subtaskRunner, {adrscript, "everyMinute"})}; if minute == user.scheduler2.prefs.minuteToRunHourlyTasks { local (adrscript); for adrscript in @user.scheduler2.hourly { thread.callscript (@scheduler2.subtaskRunner, {adrscript, "hourly"})}}; if hour == user.scheduler2.prefs.hourToRunOvernightTasks { if minute == 0 { for adrscript in @user.scheduler2.overnight { thread.callscript (@scheduler2.subtaskRunner, {adrscript, "overnight"})}; local (adrscript)}}}; bundle { //status message local (s = "scheduler2: " + date.timestring (now, true) + "; "); bundle { //add threads local (ctthreads = Frontier.countThreads ()); if ctthreads == 1 { s = s + "1 thread"} else { s = s + ctthreads + " threads"}}; bundle { //add hits if web server is turned on try { if inetd.isDaemonRunning (@user.inetd.config.http) { //web server is turned on s = s +"; " + user.webserver.stats.hits + " hits"; if defined (user.scheduler2.stats.webserver.lastUrl) { //6/11/08 by DW s = s + "; " + user.scheduler2.stats.webserver.lastUrl}}}}; if user.scheduler2.prefs.flMessages { //8/18/08 by DW msg (s + ".")}}; thread.sleepfor (1)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.