2021-08-17 14:26:04 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-08-17 18:35:21 -05:00
|
|
|
update_reboot_cause()
|
2022-10-10 20:49:26 -05:00
|
|
|
{
|
|
|
|
DEVICE_MGR_REBOOT_FILE=/tmp/device_mgr_reboot
|
|
|
|
REBOOT_CAUSE_FILE=/host/reboot-cause/reboot-cause.txt
|
2023-08-17 18:35:21 -05:00
|
|
|
DEVICE_REBOOT_CAUSE_FILE=/etc/opt/srlinux/reboot-cause.txt
|
|
|
|
if [ -e $DEVICE_MGR_REBOOT_FILE ]; then
|
|
|
|
if [ -e $DEVICE_REBOOT_CAUSE_FILE ]; then
|
|
|
|
cp -f $DEVICE_REBOOT_CAUSE_FILE $REBOOT_CAUSE_FILE
|
2022-10-10 20:49:26 -05:00
|
|
|
fi
|
2023-08-17 18:35:21 -05:00
|
|
|
rm -f $DEVICE_MGR_REBOOT_FILE
|
|
|
|
else
|
|
|
|
touch /etc/opt/srlinux/devmgr_reboot_cause.done
|
|
|
|
rm -f $DEVICE_REBOOT_CAUSE_FILE &> /dev/null
|
2022-10-10 20:49:26 -05:00
|
|
|
fi
|
2023-08-17 18:35:21 -05:00
|
|
|
sync
|
2022-10-10 20:49:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# update the reboot_cuase file when reboot is trigger by device-mgr
|
2023-08-17 18:35:21 -05:00
|
|
|
update_reboot_cause
|
2022-10-10 20:49:26 -05:00
|
|
|
|
2021-08-17 14:26:04 -05:00
|
|
|
systemctl stop nokia-watchdog.service
|
|
|
|
sleep 2
|
|
|
|
echo "w" > /dev/watchdog
|
|
|
|
kick_date=`date -u`
|
|
|
|
echo "last watchdog kick $kick_date" > /var/log/nokia-watchdog-last.log
|
2021-10-14 15:47:12 -05:00
|
|
|
rm -f /sys/firmware/efi/efivars/dump-*
|
2021-08-17 14:26:04 -05:00
|
|
|
sync
|
2023-04-27 10:53:16 -05:00
|
|
|
exec /sbin/reboot $@
|