sonic-buildimage/files/image_config/syslog/host_umount.sh
rkdevi27 6c2fd18f51
Fixed S6000 abrupt reboot in 201811 (#6923)
Why I did it
The S6000 devices, the cold reboot is abrupt and it is likely to cause issues which will cause the device to land into EFI shell. Hence the platform reboot will happen after graceful unmount of all the filesystems as in S6100.

How I did it
Moved the platform_reboot to platform_reboot_override and hooked it to the systemd shutdown services as in S6100.
Fixed the "/host unmount failed" issue as well in 201811.

How to verify it
Issue "reboot" command to verify if the reboot is happening gracefully.
2021-03-12 11:09:54 -08:00

32 lines
675 B
Bash
Executable File

#!/bin/bash
# This script is invoked at the closure of syslog socket during reboot
# This will stop journal services, unmount /var/log and delete loop device
# associated to /host to ensure proper unmount of /host
journal_stop() {
systemctl stop systemd-journald.service
}
delete_loop_device() {
umount /var/log
if [[ $? -ne 0 ]]
then
exit 0
fi
loop_exist=$(losetup -a | grep loop1 | wc -l)
if [ $loop_exist -ne 0 ]; then
losetup -d /dev/loop1
fi
}
case "$1" in
journal_stop|delete_loop_device)
$1
;;
*)
echo "Usage: $0 {journal_stop|delete_loop_device}" >&2
exit 1
;;
esac