diff --git a/enedisgateway2mqtt/rootfs/scripts/99-run.sh b/enedisgateway2mqtt/rootfs/scripts/99-run.sh index 26c7ee246..baf4e6a7b 100644 --- a/enedisgateway2mqtt/rootfs/scripts/99-run.sh +++ b/enedisgateway2mqtt/rootfs/scripts/99-run.sh @@ -66,8 +66,11 @@ fi ################ if bashio::config.has_value "TZ"; then TZ=$(bashio::config "TZ") - bashio::log.info "Timezone set to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + if [ -f /usr/share/zoneinfo/$TZ ]; then + bashio::log.info "Timezone set from $(cat /etc/timezone) to $TZ" + ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + else + bashio::log.warning "Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" fi ##############