From 36627a4eb7fb0d505c6df7897083d161e59cdf34 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Thu, 19 Sep 2019 14:05:15 +0200 Subject: Style improvements --- include/tests_boot_services | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'include/tests_boot_services') diff --git a/include/tests_boot_services b/include/tests_boot_services index 2fee353f..fe6e316e 100644 --- a/include/tests_boot_services +++ b/include/tests_boot_services @@ -749,14 +749,14 @@ Linux) # Idle time, not real uptime if [ -f /proc/uptime ]; then - UPTIME_IN_SECS=$(cat /proc/uptime | ${CUTBINARY} -d ' ' -f1 | ${CUTBINARY} -d '.' -f1) + UPTIME_IN_SECS=$(${CUTBINARY} -d ' ' -f1 /proc/uptime | ${CUTBINARY} -d '.' -f1) else 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)" fi - ;; + ;; - DragonFly | FreeBSD | macOS) + DragonFly | FreeBSD | macOS) if [ -n "${SYSCTLBINARY}" ]; then TIME_BOOT=$(${SYSCTLBINARY} kern.boottime | ${AWKBINARY} '{ print $5 }' | ${SEDBINARY} -e 's/,//' | ${GREPBINARY} "[0-9]") TIME_NOW=$(date "+%s") @@ -771,9 +771,9 @@ Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW ReportException "${TEST_NO}:4" "No uptime test available for this operating system (sysctl missing)" fi - ;; + ;; - NetBSD | OpenBSD) + NetBSD | OpenBSD) if [ -n "${SYSCTLBINARY}" ]; then TIME_BOOT=$(${SYSCTLBINARY} -n kern.boottime) TIME_NOW=$(date "+%s") @@ -788,7 +788,7 @@ Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW ReportException "${TEST_NO}:4" "No uptime test available for this operating system (sysctl missing)" fi - ;; + ;; Solaris) if [ -n "${KSTATBINARY}" ]; then @@ -797,15 +797,16 @@ 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)" fi - ;; + ;; *) Display --indent 2 --text "- Checking uptime" --result "${STATUS_SKIPPED}" --color YELLOW # Want to help improving Lynis? Share your operating system and a way to determine the uptime (in seconds) ReportException "${TEST_NO}:3" "No uptime test available yet for this operating system" - ;; + ;; esac + if [ -n "${UPTIME_IN_SECS}" ]; then UPTIME_IN_DAYS=$((UPTIME_IN_SECS / 60 / 60 / 24)) LogText "Uptime (in seconds): ${UPTIME_IN_SECS}" -- cgit v1.2.3