Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,17 @@ fi

# Reboot: explicitly call Linux native reboot under sbin
debug "Rebooting with ${REBOOT_METHOD} to ${NEXT_SONIC_IMAGE} ..."

LOGS_ON_TMPFS=0
df --output=fstype /var/log* | grep 'tmpfs' || LOGS_ON_TMPFS=$?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use grep -c instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated now.

if [[ LOGS_ON_TMPFS -eq 0 ]]; then
debug "Backup shutdown logs to /host/logs_before_reboot"
mkdir -p /host/logs_before_reboot || /bin/true
# maxdepth 2: find files within 2 nested directories (eg. /var/log/ and /var/log/swss/)
# mmin 30: find files written in past 30 minutes
find /var/log -maxdepth 2 -mmin -30 -type f | xargs -I {} cp {} /host/logs_before_reboot/ || /bin/true
fi

exec ${REBOOT_METHOD}

# Should never reach here
Expand Down