11#! /bin/bash
22
33# Check root privileges
4- if [ " $EUID " -ne 0 ]
4+ if [[ " $EUID " -ne 0 ] ]
55then
66 echo " Please run as root"
77 exit
88fi
99
1010
1111# Unload the previously loaded kernel if any loaded
12- if [ " $( cat /sys/kernel/kexec_loaded) " -eq 1 ]
12+ if [[ " $( cat /sys/kernel/kexec_loaded) " -eq 1 ] ]
1313then
1414 /sbin/kexec -u
1515fi
@@ -27,33 +27,28 @@ sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)
2727/sbin/kexec -l " $KERNEL_IMAGE " --initrd=" $INITRD " --append=" $BOOT_OPTIONS "
2828
2929# Dump the ARP and FDB tables to files also as default routes for both IPv4 and IPv6
30- /usr/bin/fast-reboot-dump.py
31- docker cp /tmp/fdb.json swss:/
32- docker cp /tmp/arp.json swss:/
33- if [ -e /tmp/default_routes.json ]
34- then
35- docker cp /tmp/default_routes.json swss:/
36- fi
30+ # into /host/fast-reboot
31+ mkdir -p /host/fast-reboot
32+ /usr/bin/fast-reboot-dump.py /host/fast-reboot
3733
38- # Kill bgpd to enable graceful restart of BGP
39- docker exec -ti bgp killall -9 watchquagga
34+ # Kill bgpd to start the bgp graceful restart procedure
4035docker exec -ti bgp killall -9 zebra
4136docker exec -ti bgp killall -9 bgpd
4237
4338# Kill lldp, otherwise it sends informotion about reboot
44- docker kill lldp
39+ docker kill lldp > /dev/null
4540
4641# Kill teamd, otherwise it gets down all LAGs
47- docker kill teamd
42+ docker kill teamd > /dev/null
4843
49- # Kill other containers to make reboot faster
50- docker ps -qa | xargs docker kill
44+ # Kill other containers to make the reboot faster
45+ docker ps -q | xargs docker kill > /dev/null
5146
5247# Stop the docker container engine. Otherwise we will have a broken docker storage
5348systemctl stop docker.service
5449
5550# Stop opennsl modules for Broadcom platform
56- if [ " $sonic_asic_type " = ' broadcom' ];
51+ if [[ " $sonic_asic_type " = ' broadcom' ] ];
5752then
5853 service_name=$( systemctl list-units --plain --no-pager --no-legend --type=service | grep opennsl | cut -f 1 -d' ' )
5954 systemctl stop " $service_name "
0 commit comments