diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 21d153e8f3..ba397e5ea0 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -59,6 +59,6 @@ sync sleep 1 sync -# Reboot +# Reboot: explicity call Linux native reboot under sbin echo "Rebooting to $NEXT_SONIC_IMAGE..." -reboot +/sbin/reboot diff --git a/scripts/reboot b/scripts/reboot new file mode 100755 index 0000000000..019e5ad762 --- /dev/null +++ b/scripts/reboot @@ -0,0 +1,28 @@ +#! /bin/bash + +function stop_sonic_services() +{ + echo "Stopping sonic services..." + systemctl stop swss + systemctl stop teamd + systemctl stop bgp + systemctl stop lldp + systemctl stop snmp +} + +# Obtain our platform as we will mount directories with these names in each docker +PLATFORM=`sonic-cfggen -v platform` + +DEVPATH="/usr/share/sonic/device" +REBOOT="platform_reboot" + +if [ -x ${DEVPATH}/${PLATFORM}/${REBOOT} ]; then + stop_sonic_services + sync + sleep 3 + echo "Rebooting with platform ${PLATFORM} specific tool ..." + ${DEVPATH}/${PLATFORM}/${REBOOT} + exit 0 +fi + +/sbin/reboot $@ diff --git a/setup.py b/setup.py index bec645946b..61e42fd438 100644 --- a/setup.py +++ b/setup.py @@ -49,6 +49,7 @@ def get_test_suite(): 'scripts/port2alias', 'scripts/portconfig', 'scripts/portstat', + 'scripts/reboot', 'scripts/teamshow' ], data_files=[