#!/bin/sh # -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*- # The idea here is to run ansible_local.bash --tags daily # and then use this to do the parsing and throwing errors based on the output. # This way the ansible run can be free from erroring and this can be # run repeatedly anytime outside of ansible to deal with the issues raised. # It is also run at the end of ansible_local.bash --tags daily to raise the issues. prog=`basename $0 .bash` PREFIX=/usr/local ROLE=toxcore [ -f /usr/local/etc/testforge/testforge.bash ] || \ . /usr/local/etc/testforge/testforge.bash . /usr/local/bin/usr_local_tput.bash TOXCORE_LOG_DIR=$PREFIX/var/log [ -d $TOXCORE_LOG_DIR ] || mkdir -p $TOXCORE_LOG_DIR MYID=`id -u` [ $MYID -eq 0 ] || WARN $prog should be run as root $MYID which ansifilter >/dev/null 2>&1 && ansifilter=ansifilter || ansifilter=cat ly=hourly i=0 errs=0 warns=0 WLOG="$TOXCORE_LOG_DIR"/$ly/W$prog$$.log ELOG="$TOXCORE_LOG_DIR"/$ly/E$prog$$.log #?ols_make_testforge_logs $TOXCORE_LOG_DIR [ -d "$TOXCORE_LOG_DIR"/$ly/ ] && \ find "$TOXCORE_LOG_DIR"/$ly/ -type f -name W${prog}*.log \ -o -name E${prog}*.log -mtime +1 -delete if [ -d /etc/libvirt/qemu ] && [ $MYID -eq 0 ] ; then elt=qemu DBUG elt=$elt [ -d /var/lib/libvirt/dnsmasq/ ] && \ sudo find /var/lib/libvirt/dnsmasq/ -mtime +1 -empty -delete if virsh net-list | grep -q External ; then /usr/local/bin/toxcore_libvirt_test_ga.bash fi # -%d if ls /var/log/libvirt/qemu/*.log 2>/dev/null >/dev/null ; then grep ^`date +%Y-%m`.*warning /var/log/libvirt/qemu/*.log | tee -a $WLOG fi fi if [ -s $ELOG ] ; then errs=`grep -c ERROR: "$ELOG"` [ $errs -ne 0 ] && \ ERROR "$prog $ly $errs errors in $ELOG" && \ exit -$errs fi if [ -s $WLOG ] ; then warns=`grep -c WARN: "$WLOG"` [ $warns -ne 0 ] && \ WARN "$prog $ly $warns warnings in $WLOG" fi [ $warns -eq 0 -a $errs -eq 0 ] && \ INFO "No $ly errors in $TOXCORE_LOG_DIR" exit 0