summaryrefslogtreecommitdiff
path: root/scripts/aggregate.sh
diff options
context:
space:
mode:
authorFredrik Aslund <fredrik.aslund@umu.se>2016-11-04 12:03:55 +0100
committerFredrik Aslund <fredrik.aslund@umu.se>2016-11-04 12:03:55 +0100
commit6e7ed0ad3720f127fa5ece90fd24558d25a68ac6 (patch)
tree7457f2cf1bb84d35803e30d9d2a2859a15f98937 /scripts/aggregate.sh
parente06d64c102d33276333caf73a170451525030c9a (diff)
run aggregate on md1/md2 every 60 minutes, do not commit to git
Diffstat (limited to 'scripts/aggregate.sh')
-rwxr-xr-xscripts/aggregate.sh31
1 files changed, 28 insertions, 3 deletions
diff --git a/scripts/aggregate.sh b/scripts/aggregate.sh
index 25763dee..fa108398 100755
--- a/scripts/aggregate.sh
+++ b/scripts/aggregate.sh
@@ -1,14 +1,39 @@
#!/bin/sh
+aggregate_interval_min=60
+cmd_timeout_s=600
+
DIR=`pwd`
ODIR=$1
-rm $ODIR/*.xml
+rm -f $ODIR/*.xml
+
+last_aggregate_ts=$ODIR/last_aggregate.ts
+
+if find $last_aggregate_ts -mmin -$aggregate_interval_min 2>/dev/null | grep -q . ; then
+ exit 0
+else
+ touch $last_aggregate_ts
+fi
grep -v -e '^#' $ODIR/metadata.lst | (while read url cert; do
cfile=""
if [ "x$cert" != "x" ]; then
cfile=$DIR/certs/$cert
fi
- $DIR/scripts/pull-and-verify.sh $url $ODIR $cfile
-done)
+ cmd="$DIR/scripts/pull-and-verify.sh $url $ODIR $cfile"
+ timeout $cmd_timeout_s $cmd 2>&1
+ ret=$?
+ case $ret in
+ 0)
+ ;;
+ 124)
+ echo "$cmd timed out after $cmd_timeout_s seconds"
+ exit $ret
+ ;;
+ *)
+ echo "$cmd failed with exit code $ret, output:"
+ exit $ret
+ ;;
+ esac
+done) || exit $ret