File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ ntp_default_file=' /etc/default/ntp'
4
+ ntp_temp_file=' /tmp/ntp.orig'
5
+
6
+ reboot_type=' cold'
7
+
8
+ function get_database_reboot_type()
9
+ {
10
+ SYSTEM_WARM_START=` /usr/bin/redis-cli -n 6 hget " WARM_RESTART_ENABLE_TABLE|system" enable`
11
+ SYSTEM_FAST_START=` /usr/bin/redis-cli -n 6 get " FAST_REBOOT|system" `
12
+
13
+ if [[ x" ${SYSTEM_WARM_START} " == x" true" ]]; then
14
+ reboot_type=' warm'
15
+ elif [[ x" ${SYSTEM_FAST_START} " == x" 1" ]]; then
16
+ reboot_type=' fast'
17
+ fi
18
+ }
19
+
20
+ function modify_ntp_default
21
+ {
22
+ cp ${ntp_default_file} ${ntp_temp_file}
23
+ sed -e " $1 " ${ntp_temp_file} > ${ntp_default_file}
24
+ }
25
+
3
26
sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 > /etc/ntp.conf
4
27
28
+ get_database_reboot_type
29
+ if [[ x" ${reboot_type} " == x" cold" ]]; then
30
+ echo " Enabling NTP long jump for reboot type ${reboot_type} ..."
31
+ modify_ntp_default " s/NTPD_OPTS='-x'/NTPD_OPTS='-g'/"
32
+ else
33
+ echo " Disabling NTP long jump for reboot type ${reboot_type} ..."
34
+ modify_ntp_default " s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/"
35
+ fi
36
+
5
37
systemctl restart ntp
You can’t perform that action at this time.
0 commit comments