From 69fa434b445fba7bf49da836c4c71bed5dda486a Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 6 Jul 2023 13:05:33 +0200 Subject: [PATCH] confd: call lldpcl and avahi-set-host-name after system bootstrap Services have not even started up yet, so system() calls will only unnecessarily delay the boot. Signed-off-by: Joachim Wiberg --- src/confd/src/confd/ietf-system.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/confd/src/confd/ietf-system.c b/src/confd/src/confd/ietf-system.c index cd7740a9..35a870b9 100644 --- a/src/confd/src/confd/ietf-system.c +++ b/src/confd/src/confd/ietf-system.c @@ -971,9 +971,12 @@ static int change_hostname(sr_session_ctx_t *session, uint32_t sub_id, const cha free(hosts); free(current); - /* Inform any running lldpd and avahi of the change ... */ - systemf("lldpcli configure system hostname %s", nm); - systemf("avahi-set-host-name %s", nm); + /* skip in bootstrap, daemons not started yet*/ + if (!systemf("runlevel >/dev/null 2>&1")) { + /* Inform any running lldpd and avahi of the change ... */ + systemf("lldpcli configure system hostname %s", nm); + systemf("avahi-set-host-name %s", nm); + } err: if (nm) free(nm);