mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-27 15:54:09 +02:00
[BOOT-5202] use generic variables between OSes
This commit is contained in:
parent
61fb197638
commit
7b8c04c3b1
@ -682,11 +682,12 @@
|
|||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
FOUND=0
|
FOUND=0
|
||||||
FIND=""
|
FIND=""
|
||||||
|
UPTIME_IN_SECS=""
|
||||||
case "${OS}" in
|
case "${OS}" in
|
||||||
Linux)
|
Linux)
|
||||||
# Idle time, not real uptime
|
# Idle time, not real uptime
|
||||||
if [ -f /proc/uptime ]; then
|
if [ -f /proc/uptime ]; then
|
||||||
FIND=$(cat /proc/uptime | ${CUTBINARY} -d ' ' -f1 | ${CUTBINARY} -d '.' -f1)
|
UPTIME_IN_SECS=$(cat /proc/uptime | ${CUTBINARY} -d ' ' -f1 | ${CUTBINARY} -d '.' -f1)
|
||||||
else
|
else
|
||||||
Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW
|
Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW
|
||||||
ReportException "${TEST_NO}:1" "No uptime test available for this operating system (/proc/uptime missing)"
|
ReportException "${TEST_NO}:1" "No uptime test available for this operating system (/proc/uptime missing)"
|
||||||
@ -729,7 +730,7 @@
|
|||||||
|
|
||||||
Solaris)
|
Solaris)
|
||||||
if [ ! -z "${KSTATBINARY}" ]; then
|
if [ ! -z "${KSTATBINARY}" ]; then
|
||||||
FIND=$(${KSTATBINARY} -p unix:0:system_misc:snaptime | ${GREPBINARY} "^unix" | ${AWKBINARY} '{print $2}' | ${CUTBINARY} -d "." -f1)
|
UPTIME_IN_SECS=$(${KSTATBINARY} -p unix:0:system_misc:snaptime | ${GREPBINARY} "^unix" | ${AWKBINARY} '{print $2}' | ${CUTBINARY} -d "." -f1)
|
||||||
else
|
else
|
||||||
Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW
|
Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW
|
||||||
ReportException "${TEST_NO}:2" "No uptime test available for this operating system (kstat missing)"
|
ReportException "${TEST_NO}:2" "No uptime test available for this operating system (kstat missing)"
|
||||||
@ -743,8 +744,7 @@
|
|||||||
ReportException "${TEST_NO}:3" "No uptime test available yet for this operating system"
|
ReportException "${TEST_NO}:3" "No uptime test available yet for this operating system"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ ! -z "${FIND}" ]; then
|
if [ ! -z "${UPTIME_IN_SECS}" ]; then
|
||||||
UPTIME_IN_SECS="${FIND}"
|
|
||||||
UPTIME_IN_DAYS=$((UPTIME_IN_SECS / 60 / 60 / 24))
|
UPTIME_IN_DAYS=$((UPTIME_IN_SECS / 60 / 60 / 24))
|
||||||
LogText "Uptime (in seconds): ${UPTIME_IN_SECS}"
|
LogText "Uptime (in seconds): ${UPTIME_IN_SECS}"
|
||||||
LogText "Uptime (in days): ${UPTIME_IN_DAYS}"
|
LogText "Uptime (in days): ${UPTIME_IN_DAYS}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user