summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-01-13 22:07:34 +0100
committerChristian Breunig <christian@breunig.cc>2023-01-14 21:13:37 +0100
commit0d35a866ba12e66e504e1f575a04429c5d8cb9be (patch)
tree552d760211fbfca1ff4aa82625669eb501e56262 /src/op_mode
parentf570fce12e8675a66ef8a24e2e600c687475ebe7 (diff)
downloadvyos-1x-0d35a866ba12e66e504e1f575a04429c5d8cb9be.tar.gz
vyos-1x-0d35a866ba12e66e504e1f575a04429c5d8cb9be.zip
ntp: T3008: migrate from ntpd to chrony
* Move CLI from "system ntp" -> "service ntp" * Drop NTP server option preempt as not supported by chrony
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/show_ntp.sh31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/op_mode/show_ntp.sh b/src/op_mode/show_ntp.sh
index e9dd6c5c9..85f8eda15 100755
--- a/src/op_mode/show_ntp.sh
+++ b/src/op_mode/show_ntp.sh
@@ -1,39 +1,34 @@
#!/bin/sh
-basic=0
-info=0
+sourcestats=0
+tracking=0
while [[ "$#" -gt 0 ]]; do
case $1 in
- --info) info=1 ;;
- --basic) basic=1 ;;
- --server) server=$2; shift ;;
+ --sourcestats) sourcestats=1 ;;
+ --tracking) tracking=1 ;;
*) echo "Unknown parameter passed: $1" ;;
esac
shift
done
-if ! ps -C ntpd &>/dev/null; then
+if ! ps -C chronyd &>/dev/null; then
echo NTP daemon disabled
exit 1
fi
-PID=$(pgrep ntpd)
-VRF_NAME=$(ip vrf identify ${PID})
+PID=$(pgrep chronyd | head -n1)
+VRF_NAME=$(ip vrf identify )
if [ ! -z ${VRF_NAME} ]; then
VRF_CMD="sudo ip vrf exec ${VRF_NAME}"
fi
-if [ $basic -eq 1 ]; then
- $VRF_CMD ntpq -n -c peers
-elif [ $info -eq 1 ]; then
- echo "=== sysingo ==="
- $VRF_CMD ntpq -n -c sysinfo
- echo
- echo "=== kerninfo ==="
- $VRF_CMD ntpq -n -c kerninfo
-elif [ ! -z $server ]; then
- $VRF_CMD /usr/sbin/ntpdate -q $server
+if [ $sourcestats -eq 1 ]; then
+ $VRF_CMD chronyc sourcestats -v
+elif [ $tracking -eq 1 ]; then
+ $VRF_CMD chronyc tracking -v
+else
+ echo "Unknown option"
fi