diff --git a/openwrt/files/etc/udhcpc.user b/openwrt/files/etc/udhcpc.user index ce3b7424..103ae0f2 100644 --- a/openwrt/files/etc/udhcpc.user +++ b/openwrt/files/etc/udhcpc.user @@ -21,16 +21,16 @@ case "$1" in /root/bin/apinger-pop.sh "$router" fi - if [ ! -z "$hostname" ]; then + if [ ! -z "$hostname" ] && [ `echo "$HOSTNAME" | tr '[A-Z]' '[a-z]'` != `echo "$hostname" | tr '[A-Z]' '[a-z]'` ]; then + # set new hostname uci set 'system.@system[0].hostname'="$hostname" uci commit - if [ `echo "$HOSTNAME" | tr '[A-Z]' '[a-z]'` != `echo "$hostname" | tr '[A-Z]' '[a-z]'` ]; then - # reload/restart whatever needs the hostname updated - /etc/init.d/system reload - service zabbix_agentd restart - service rsyslog restart - service lldpd restart - fi + + # reload/restart whatever needs the hostname updated + /etc/init.d/system reload + service zabbix_agentd restart + service rsyslog restart + service lldpd restart fi if [ ! -z "$opt226" ]; then /root/bin/config-version.sh -c $(printf %d "0x$opt226")