kerzenziehen-kundendisplay/start-kundendisplay.sh

47 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2024-07-04 21:15:40 +00:00
#!/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!"