Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -530,12 +530,12 @@ (define configf:read-file read-config) ;; safely look up a value that is expected to be a number, return ;; a default (#f unless provided) ;; -(define (configf:lookup-number cfdat section varname #!key (default #f)) - (let* ((val (configf:lookup *configdat* section varname)) +(define (configf:lookup-number cfgdat section varname #!key (default #f)) + (let* ((val (configf:lookup cfgdat section varname)) (res (if val (string->number (string-substitute "\\s+" "" val #t)) #f))) (cond (res res) Index: mtut.scm ================================================================== --- mtut.scm +++ mtut.scm @@ -1619,10 +1619,11 @@ (let* ((mtconfdat (simple-setup (args:get-arg "-start-dir"))) (mtconf (car mtconfdat)) (toppath (configf:lookup mtconf "scratchdat" "toppath")) (period (configf:lookup-number mtconf "mtutil" "autorun-period" default: 300)) (rest-time (configf:lookup-number mtconf "mtutil" "autorun-rest" default: 30))) + (print "Using period="period" and rest time="rest-time) (case (string->symbol *action*) ((process) (begin (common:load-pkts-to-db mtconf) (generate-run-pkts mtconf toppath) (common:load-pkts-to-db mtconf) @@ -1650,10 +1651,11 @@ (delete-file* "do-not-run-mtutil-go"))) (let loop ((last-run (- (current-seconds) (+ period 10))) ;; fake out first time in (this-run (current-seconds))) (if (file-exists? "do-not-run-mtutil-go") (begin + (print "File do-not-run-mtutil-go exists, exiting.") (delete-file* "mtutil-go.pid") (exit))) (let ((delta (- this-run last-run))) (if (>= delta period) (let* ((mtconfdat (simple-setup (args:get-arg "-start-dir"))) @@ -1665,12 +1667,11 @@ (print "Running run dispatch at " (current-seconds)) (common:load-pkts-to-db mtconf) (dispatch-commands mtconf toppath) (print "Done running import, generate, and dispatch done in " (- (current-seconds) this-run)) (print "NOTE: touch " (current-directory) "/do-not-run-mtutil-go to kill this runner.") - (loop this-run (current-seconds)) - ) + (loop this-run (current-seconds))) (let ((now (current-seconds))) (print "Sleeping " rest-time " seconds, next run in aproximately " (- period (- now last-run)) " seconds") (thread-sleep! rest-time) (loop last-run (current-seconds)))))) (delete-file* "mtutil-go.pid")))))