Sync Hostname everytime with nodewatcher, fixed small bug in tincstart

This commit is contained in:
floh1111 2011-06-30 18:37:02 +00:00
parent 5f4bdffc34
commit cff6d5a1e2
2 changed files with 13 additions and 0 deletions

View File

@ -441,6 +441,17 @@ crawl() {
if [ $error_level -gt "1" ]; then
echo "`date`: Das Senden der Statusdaten war nach dem `expr $i + 1`. Mal erfolgreich" >> $logfile
fi
netmon_hostname="`echo $api_return | cut '-d;' -f2`"
if [ "$netmon_hostname" != "`cat /proc/sys/kernel/hostname`" ]; then
if [ $error_level -gt "1" ]; then
echo "`date`: Setze neuen Hostname (Hostname synchronisation)" >> $logfile
fi
uci set system.@system[0].hostname=$netmon_hostname
uci commit
echo $netmon_hostname > /proc/sys/kernel/hostname
fi
break;
else
if [ $error_level -gt "0" ]; then

View File

@ -19,10 +19,12 @@ then
hostname=$(cat /proc/sys/kernel/hostname)
if [ "$hostname" == "OpenWrt" ]
then
hostname=""
fi
if [ "$hostname" == "" ]
then
hostname=$(ifconfig br-mesh | grep HWaddr | awk '{ print $5 }'|sed -e 's/://g')
fi