mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 06:06:32 +00:00
Init: make some panic vars public
This commit is contained in:
parent
000eff13a3
commit
58a6be0e49
@ -3,5 +3,5 @@
|
|||||||
source /etc/init.d/panic
|
source /etc/init.d/panic
|
||||||
|
|
||||||
# reset panic counter after a successful boot
|
# reset panic counter after a successful boot
|
||||||
echo 0 > ${_PANIC_COUNTER_FILE}
|
echo 0 > ${PANIC_COUNTER_FILE}
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
|
|
||||||
_PANIC_COUNTER_FILE="/var/lib/panic_counter"
|
PANIC_COUNTER_FILE="/var/lib/panic_counter"
|
||||||
_PANIC_REBOOT_DELAY_FACTOR=10
|
PANIC_REBOOT_DELAY_FACTOR=10
|
||||||
_PANIC_REBOOT_DELAY_MAX=3600 # reboot at least once an hour in case of panic
|
PANIC_REBOOT_DELAY_MAX=3600 # reboot at least once an hour in case of panic
|
||||||
|
|
||||||
|
|
||||||
panic_action() {
|
panic_action() {
|
||||||
# read counter from file
|
# 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
|
# 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))
|
delay=$((PANIC_REBOOT_DELAY_FACTOR * panic_counter))
|
||||||
if [[ "${delay}" -gt "${_PANIC_REBOOT_DELAY_MAX}" ]]; then
|
if [[ "${delay}" -gt "${PANIC_REBOOT_DELAY_MAX}" ]]; then
|
||||||
delay=${_PANIC_REBOOT_DELAY_MAX}
|
delay=${PANIC_REBOOT_DELAY_MAX}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${delay}" -gt 0 ]]; then
|
if [[ "${delay}" -gt 0 ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user