On 2023-03-12 13:38, mh@mike.franken.de wrote:
Hi,
in case anyone needs this functionality:
function ntp2timesyncd { # add ntp servers to systemd-timesyncd MYACTION="$1" CON_UUID="$2" [ -z "$MYACTION" -o -z "$CON_UUID" ] && return
_svc="systemd-timesyncd" if [ "$( ${SYSCTL} is-enabled ${_svc}.service )" = "enabled" ] # { then NTPCFGD="/etc/systemd/timesyncd.conf.d" mkdir -p "$NTPCFGD" [ -d "$NTPCFGD" ] || return NTPCFG="${NTPCFGD}/${CON_UUID}.conf" RST=0 case "$MYACTION" in # { down|vpn-down) /usr/bin/rm -f "$NTPCFG" RST=1 ;; up|vpn-up|dhcp4-change|dhcp6-change) _NTP="${DHCP4_NTP_SERVERS} ${DHCP6_NTP_SERVER}" # if no ntpservers provided by dhcp, try to get them from the # static netconfig configuration if [ -z $_NTP ] then NCNETCFG="/etc/sysconfig/network/config" [ -n "$NCNETCFG" -a -r "$NCNETCFG" ] \ && source <( cat "$NCNETCFG" \ | grep "^NETCONFIG_NTP_STATIC_SERVERS=" \ ) _NTP="$NETCONFIG_NTP_STATIC_SERVERS" fi
Wouldn't . /etc/sysconfig/network/config work? Then just test/use $NETCONFIG_NTP_STATIC_SERVERS -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)