diff --git a/gatherLogs.sh b/gatherLogs.sh new file mode 100755 index 0000000..73f3e86 --- /dev/null +++ b/gatherLogs.sh @@ -0,0 +1,21 @@ +#!/bin/bash +cd ~/RMS_data/logs + +# +# Script to gather the logfiles and upload them for debugging & analysis +# +source /home/pi/source/ukmon-pitools/ukmon.ini +sudo cp /var/log/kern.log . +sudo chown pi:pi kern.log +cp /var/log/messages ./messages.log +cp /home/pi/source/RMS/.config ${LOCATION}.config +cp /home/pi/source/RMS/platepar_cmn2010.cal ${LOCATION}.cal +ZIPFILE=/tmp/${LOCATION}_logs.tgz +tar cvzf $ZIPFILE *.log* ${LOCATION}.config ${LOCATION}.cal +sftp -i $UKMONKEY -q logupload@$UKMONHELPER << EOF +cd logs +progress +put $ZIPFILE +exit +EOF +rm kern.log messages.log $ZIPFILE ${LOCATION}.config ${LOCATION}.cal diff --git a/ukmonPostProc.py b/ukmonPostProc.py index 03e121c..f6e7739 100644 --- a/ukmonPostProc.py +++ b/ukmonPostProc.py @@ -71,8 +71,12 @@ def installUkmonFeed(): def rmsExternal(cap_dir, arch_dir, config): # called from RMS to trigger the UKMON specific code - initLogging(config, 'ukmon_') + # clear existing log handlers log = logging.getLogger("logger") + while len(log.handlers) > 0: + log.removeHandler(log.handlers[0]) + + initLogging(config, 'ukmon_') log.info('ukmon external script started') rebootlockfile = os.path.join(config.data_dir, config.reboot_lock_file)