stable #2
@@ -21,26 +21,20 @@ while [ -z "$monitor" ]; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
monitor_md5=$(echo -n ${monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
|
# Filter the first word from the initial monitor
|
||||||
echo "Monitor MD5: $monitor_md5" >> $LOGFILE # Debug output
|
initial_monitor_first_word=$(echo "$monitor" | awk '{print $1}')
|
||||||
|
echo "Monitor (first word): $initial_monitor_first_word" >> $LOGFILE # Debug output
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
new_monitor=$(get_monitor)
|
new_monitor=$(get_monitor | awk '{print $1}')
|
||||||
new_current=$(get_current_window)
|
new_current=$(get_current_window | awk '{print $1}')
|
||||||
|
|
||||||
# Log the current state
|
# Log the current state
|
||||||
echo "New monitor: $new_monitor" >> $LOGFILE # Debug output
|
echo "New monitor (first word): '$new_monitor'" >> $LOGFILE # Debug output
|
||||||
echo "New current window: $new_current" >> $LOGFILE # Debug output
|
echo "New current window (first word): '$new_current'" >> $LOGFILE # Debug output
|
||||||
|
|
||||||
if [ -n "$new_monitor" ] && [ -n "$new_current" ]; then
|
if [ -n "$new_monitor" ] && [ -n "$new_current" ]; then
|
||||||
new_monitor_md5=$(echo -n ${new_monitor^^} | sed -e 's/^[[:space:]]*//' | md5sum | awk '{print $1}')
|
if [ "$new_monitor" != "$initial_monitor_first_word" ] || [ "$new_current" != "$initial_monitor_first_word" ]; then
|
||||||
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
|
|
||||||
echo "Mismatch detected. Rebooting now." >> $LOGFILE
|
echo "Mismatch detected. Rebooting now." >> $LOGFILE
|
||||||
sudo reboot
|
sudo reboot
|
||||||
exit 1
|
exit 1
|
||||||
@@ -54,5 +48,5 @@ while true; do
|
|||||||
sleep 5s
|
sleep 5s
|
||||||
done
|
done
|
||||||
|
|
||||||
# Version 1.0:
|
# Version 1.0:
|
||||||
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
# Created 2024 by Tim Eertmoed, Christian Hampp @ WiS IT-Solutions GmbH, Germany to work on Raspian as custom pxe init script.
|
||||||
|
|||||||
Reference in New Issue
Block a user