mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-23 21:30:17 +00:00
Add uptime to debug log (#4265)
* Add uptime to debug log Signed-off-by: Christian König <ckoenig@posteo.de> * Address github comments Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
f86ef0128e
commit
bb7c7cdf33
1 changed files with 5 additions and 0 deletions
|
@ -230,6 +230,7 @@ copy_to_debug_log() {
|
|||
}
|
||||
|
||||
initialize_debug() {
|
||||
local system_uptime
|
||||
# Clear the screen so the debug log is readable
|
||||
clear
|
||||
show_disclaimer
|
||||
|
@ -237,6 +238,10 @@ initialize_debug() {
|
|||
log_write "${COL_PURPLE}*** [ INITIALIZING ]${COL_NC}"
|
||||
# Timestamp the start of the log
|
||||
log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initialized."
|
||||
# Uptime of the system
|
||||
# credits to https://stackoverflow.com/questions/28353409/bash-format-uptime-to-show-days-hours-minutes
|
||||
system_uptime=$(uptime | awk -F'( |,|:)+' '{if ($7=="min") m=$6; else {if ($7~/^day/){if ($9=="min") {d=$6;m=$8} else {d=$6;h=$8;m=$9}} else {h=$6;m=$7}}} {print d+0,"days,",h+0,"hours,",m+0,"minutes"}')
|
||||
log_write "${INFO} System has been running for ${system_uptime}"
|
||||
}
|
||||
|
||||
# This is a function for visually displaying the current test that is being run.
|
||||
|
|
Loading…
Reference in a new issue