From d012e5193de467951ba011b5cca2cc59ee2ba915 Mon Sep 17 00:00:00 2001 From: Tim Eertmoed Date: Mon, 28 Oct 2024 16:41:08 +0100 Subject: [PATCH] usr/bin/custom/chromium-monitor aktualisiert --- usr/bin/custom/chromium-monitor | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/usr/bin/custom/chromium-monitor b/usr/bin/custom/chromium-monitor index cf276a1..1308e40 100644 --- a/usr/bin/custom/chromium-monitor +++ b/usr/bin/custom/chromium-monitor @@ -21,26 +21,20 @@ while [ -z "$monitor" ]; do fi done -monitor_md5=$(echo -n ${monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}') -echo "Monitor MD5: $monitor_md5" >> $LOGFILE # Debug output +# Filter the first word from the initial monitor +initial_monitor_first_word=$(echo "$monitor" | awk '{print $1}') +echo "Monitor (first word): $initial_monitor_first_word" >> $LOGFILE # Debug output while true; do - new_monitor=$(get_monitor) - new_current=$(get_current_window) + new_monitor=$(get_monitor | awk '{print $1}') + new_current=$(get_current_window | awk '{print $1}') # Log the current state - echo "New monitor: $new_monitor" >> $LOGFILE # Debug output - echo "New current window: $new_current" >> $LOGFILE # Debug output + echo "New monitor (first word): '$new_monitor'" >> $LOGFILE # Debug output + echo "New current window (first word): '$new_current'" >> $LOGFILE # Debug output if [ -n "$new_monitor" ] && [ -n "$new_current" ]; then - new_monitor_md5=$(echo -n ${new_monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}') - current_md5=$(echo -n ${new_current^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}') - - # Log the computed MD5 hashes - echo "New monitor MD5: $new_monitor_md5" >> $LOGFILE # Debug output - echo "Current window MD5: $current_md5" >> $LOGFILE # Debug output - - if [ "$new_monitor_md5" != "$monitor_md5" ] && [ "$current_md5" != "$monitor_md5" ]; then + if [ "$new_monitor" != "$initial_monitor_first_word" ] || [ "$new_current" != "$initial_monitor_first_word" ]; then echo "Mismatch detected. Rebooting now." >> $LOGFILE sudo reboot exit 1 @@ -54,5 +48,5 @@ while true; do sleep 5s done -# Version 1.0: -# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script. +# Version 1.0: +# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.