[Eisfair] Notfall Hardwaredefekt erfordert eisfair-Hack
Marcus Roeckrath
marcus.roeckrath at gmx.de
Sa Nov 5 18:03:57 CET 2016
Hallo Martin,
Marcus Roeckrath wrote:
> Grundzüge eines solchen Skripts habe ich hier vorliegen.
#!/bin/sh
# Errorlevels:
# 1: Fehler - keine IP feststellbar
# 2: IP nicht geaendert
# 3: IP geaendert
# 4: erstmalige Ausfuehrung
ip_address=$(curl "http://my.ip.fi")
if [ "${ip_address}" = "" ]
then
exit_code=1
else
if [ -f /tmp/wan_ip ] ; then
if grep -qv "${ip_address}" /tmp/wan_ip ; then
# IP geändert
echo "${ip_address} "`date` > /tmp/wan_ip
# eigene Aktionen anfügen
exit_code=3
else
# IP nicht geaendert
exit_code=2
fi
else
# Erstmalige Ausführung /tmp/wan_ip existiert noch nicht
echo "${ip_address} "`date` > /tmp/wan_ip
exit_code=4
fi
fi
exit ${exit_code}
--
Gruss Marcus
Mehr Informationen über die Mailingliste Eisfair