(write-line 2 (join (map string args)))
(exit 1))
-(constant 'NOW (date-value))
+(constant
+ 'NOW (date-value)
+ 'ACTDIR SITE:listener.activity.dir
+ 'CONTROL.DAT SITE:control.dat
+ 'EXTRA.DAT SITE:control.extra.dat
+ 'USAGE.DAT SITE:usage.dat
+ 'USAGE.TMP SITE:usage.tmp
+ )
# Set current time variables in local timezone
(map set '(YEAR MONTH DATE HOUR MINUTE SECOND DOY DOW)
DAY (list YEAR MONTH DATE)
HM (list HOUR MINUTE)
TOTAL '()
- CONTROL.DAT "control.dat"
- EXTRA.DAT "control-extra.dat"
- USAGE.DAT "usage.dat"
- USAGE.TMP ".usage.dat"
+ GAP SITE:control.activity.gap
+ CLIP SITE:control.activity.clip
)
# Load CONTROL.DAT
(list DOW (6 30) 120 (20 0)))
)
-(setf
- GAP (or (lookup 'gap CONTROL) 15)
- CLIP (or (lookup 'clip CONTROL) 1000)
- NET (or (lookup 'net CONTROL) "10.0.0.0/8")
- )
-
# Load the configured control mechanism
(if (lookup 'control CONTROL) (load $it)
(die "** Unknown control mechanism. Exiting!!"))
;;==== Utilities for activity data
# Activity is lines of timestamps. Collect TOTAL as list of unique
# time values (H M) within the start-end time span.
+
(define (log-name-fmt t)
(format "%d%02d%02d-.*\\.dat" (0 3 (date-list t))))
(define (log-lines f)
- (find-all "([0-9]+( \\S+)?).*" (read-file (string "activity/" f)) $1 0))
+ (find-all "([0-9]+( \\S+)?).*" (read-file (format "%s/%s" ACTDIR f)) $1 0))
# Collect all timestamps of the UTC date of the given time stamp
(define (logs t)
- (flat (map log-lines (directory "activity" (log-name-fmt t)))))
+ (flat (map log-lines (directory ACTDIR (log-name-fmt t)))))
# Translate timestamp into its local time (hour minute), if it's
# within the applicable day, null otherwise.