chiark / gitweb /
probes: start running it from cron, and some debugging
[modbot-mtm.git] / probes / modrelays-probe
index ef7c639bb2b90365b9e532078924438cf7bd2b8b..79e8ab7f5f4b0d10f13795ec888bb0ec11e0b3c9 100755 (executable)
@@ -6,6 +6,14 @@ MODRELAYS=moderators.isc.org
 PROBE_TIMEOUT=$(( 20 * 60 ))
 PROBE_EXPIRE=$(( 32 * 86400 ))
 
+case "$1" in
+received)
+       mode="$1"
+       cd "$2"
+       shift; shift; set "$mode" "$@"
+       ;;
+esac
+
 . ../global-settings
 . ./settings
 
@@ -18,8 +26,8 @@ fail () {
        exit 16
 }
 
-record-probing () {
-       # implicitly uses newsgroup, id, domain
+compute-td () {
+       # implicitly uses GROUP, id, domain
        # caller must "local td", which will be set
        local probeid=$1
 
@@ -29,6 +37,10 @@ record-probing () {
        esac
 
        td="$statedir/$probeid"
+}
+
+record-probing () {
+       compute-td "$@"
        mkdir -p $td
 }
 
@@ -339,17 +351,25 @@ mode_report () {
        done
 }
 
-mode_all () {
+mode_received () {
        no_args $#
-       for domain in $MODRELAYS; do
-               probe-domain $domain
+
+       local hn group id domain mx addr
+       while read hn group id domain mx addr; do
+               if [ x"$hn" != x"X-WebSTUMP-Relay-Probe:" ]; then continue; fi
+               if [ x"$group" != x"$GROUP" ]; then continue; fi
+               local td
+               compute-td "mx=$mx,addr=$addr"
+               >"$td/ok" ||:
+               return
        done
 }
 
-mode_auto () {
+mode_all () {
        no_args $#
-       xxx do something to cause sleeping
-       mode_all
+       for domain in $MODRELAYS; do
+               probe-domain $domain
+       done
 }
 
 mode_domain () {