From 58a6be0e49b1f60b4bbd18683c525354b881f8b9 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Fri, 11 Jan 2019 23:40:05 +0200 Subject: [PATCH] Init: make some panic vars public --- board/common/overlay/etc/init.d/bootdone | 2 +- board/common/overlay/etc/init.d/panic | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/board/common/overlay/etc/init.d/bootdone b/board/common/overlay/etc/init.d/bootdone index 14ca681cfc..38e16f566b 100755 --- a/board/common/overlay/etc/init.d/bootdone +++ b/board/common/overlay/etc/init.d/bootdone @@ -3,5 +3,5 @@ source /etc/init.d/panic # reset panic counter after a successful boot -echo 0 > ${_PANIC_COUNTER_FILE} +echo 0 > ${PANIC_COUNTER_FILE} diff --git a/board/common/overlay/etc/init.d/panic b/board/common/overlay/etc/init.d/panic index 7a1785188c..4c6c992c20 100644 --- a/board/common/overlay/etc/init.d/panic +++ b/board/common/overlay/etc/init.d/panic @@ -1,19 +1,19 @@ -_PANIC_COUNTER_FILE="/var/lib/panic_counter" -_PANIC_REBOOT_DELAY_FACTOR=10 -_PANIC_REBOOT_DELAY_MAX=3600 # reboot at least once an hour in case of panic +PANIC_COUNTER_FILE="/var/lib/panic_counter" +PANIC_REBOOT_DELAY_FACTOR=10 +PANIC_REBOOT_DELAY_MAX=3600 # reboot at least once an hour in case of panic panic_action() { # read counter from file - panic_counter=$(cat ${_PANIC_COUNTER_FILE} 2>/dev/null || echo 0) + panic_counter=$(cat ${PANIC_COUNTER_FILE} 2>/dev/null || echo 0) # write increased counter back to file - echo $((panic_counter + 1)) > ${_PANIC_COUNTER_FILE} + echo $((panic_counter + 1)) > ${PANIC_COUNTER_FILE} - delay=$((_PANIC_REBOOT_DELAY_FACTOR * panic_counter)) - if [[ "${delay}" -gt "${_PANIC_REBOOT_DELAY_MAX}" ]]; then - delay=${_PANIC_REBOOT_DELAY_MAX} + delay=$((PANIC_REBOOT_DELAY_FACTOR * panic_counter)) + if [[ "${delay}" -gt "${PANIC_REBOOT_DELAY_MAX}" ]]; then + delay=${PANIC_REBOOT_DELAY_MAX} fi if [[ "${delay}" -gt 0 ]]; then