From 66037ae2de5cbd3b7fd99f395d84f80f9a683cc8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 5 Dec 2023 16:43:12 +0100 Subject: [PATCH] cli: add 'show ntp [sources]' command to admin-exec Signed-off-by: Joachim Wiberg --- board/common/rootfs/usr/bin/ntp | 19 +++++++++++++++++++ src/klish-plugin-infix/xml/infix.xml | 9 +++++++++ 2 files changed, 28 insertions(+) create mode 100755 board/common/rootfs/usr/bin/ntp diff --git a/board/common/rootfs/usr/bin/ntp b/board/common/rootfs/usr/bin/ntp new file mode 100755 index 00000000..0fe7122a --- /dev/null +++ b/board/common/rootfs/usr/bin/ntp @@ -0,0 +1,19 @@ +#!/bin/sh +# Helper script to chronyc, checks if daemon is running + +if ! chronyc serverstats >/dev/null; then + echo "NTP client not enabled." + exit 1 +fi + +case $1 in + tracking) + chronyc tracking + ;; + sources) + chronyc sources -v + ;; + *) + echo "Unknown NTP command." + ;; +esac diff --git a/src/klish-plugin-infix/xml/infix.xml b/src/klish-plugin-infix/xml/infix.xml index 272d83b4..76ce02e1 100644 --- a/src/klish-plugin-infix/xml/infix.xml +++ b/src/klish-plugin-infix/xml/infix.xml @@ -250,6 +250,15 @@ + + ntp tracking + + + ntp sources + + + +