From 810a4205c8c8be2ef031ec071ab840b74816ff1e Mon Sep 17 00:00:00 2001 From: gruinelli Date: Thu, 4 Jul 2024 21:15:40 +0000 Subject: [PATCH] =?UTF-8?q?start-kundendisplay.sh=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start-kundendisplay.sh | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 start-kundendisplay.sh diff --git a/start-kundendisplay.sh b/start-kundendisplay.sh new file mode 100644 index 0000000..17c8289 --- /dev/null +++ b/start-kundendisplay.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Start Chromium webbrowser. +# The URL depends on the given WIFI SSID to make it easier testable. + + +logger "Kundendisplay: Waiting until we get an IP..." + +while [[ true ]]; do + IP=`ip a show wlan0 | grep inet | grep -v inet6 | awk '{print $2}' | cut -d/ -f1` + if [[ "$IP" != "" ]]; then + break + fi + /usr/bin/echo -n "." + sleep 1 +done + + +logger "Kundendisplay: We got an IP." + +SSID=`/usr/sbin/iw dev wlan0 link | /usr/bin/awk -F: '/SSID/ {print $NF}' | /usr/bin/sed 's/ //'` + + +logger "Kundendisplay: SSID: '$SSID'" + +if [[ "$SSID" == "RW" ]]; then + logger "Kundendisplay: Location: Home" + URL="http://192.168.1.99" +else + logger "Kundendisplay: location: Neuwies" + URL="http://192.168.10.10" +fi + +logger "Kundendisplay: URL: $URL" + + +#exit + + +/usr/bin/killall -q chrome # Kill it if it is already running +/usr/bin/killall -q chromium-browser # Kill it if it is already running + +logger "Kundendisplay: Starting Chromium..." +/usr/bin/chromium-browser $URL --window-position=0,0 --start-fullscreen --kiosk --noerrdialogs --disable-translate --no-first-run --fast --fast-start --disable-infobars --disable-features=TranslateUI +/usr/bin/date +logger "Kundendisplay: Chromium exited!"