From 93f1d740ff7ea90e5182f1a9185e16d42c73eca7 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 19 Sep 2022 09:31:00 +0300 Subject: [PATCH] [warm-reboot] fix warm-reboot when /tmp/cache is missing (#2367) - What I did Fixed issue when cache wasn't generated and warm reboot command fails. Fixes sonic-net/sonic-buildimage#11914 - How I did it Added a check for cache existence - How to verify it Run warm-reboot Signed-off-by: Stepan Blyschak --- scripts/fast-reboot | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 2d96dd78cf..5c81818942 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -454,10 +454,13 @@ function save_counters_folder() { if [[ "$REBOOT_TYPE" = "warm-reboot" ]]; then debug "Saving counters folder before warmboot..." counters_folder="/host/counters" + counters_cache="/tmp/cache" if [[ ! -d $counters_folder ]]; then mkdir $counters_folder fi - cp -rf /tmp/cache $counters_folder + if [[ -d $counters_cache ]]; then + cp -rf $counters_cache $counters_folder + fi fi }