diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-09-19 15:05:15 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2019-09-19 15:05:15 +0300 |
commit | 36627a4eb7fb0d505c6df7897083d161e59cdf34 (patch) | |
tree | 5efa5a2f34c6683635259a97ebbbfd3ec1739629 /include/tests_boot_services | |
parent | 950be03ddbc150d3b61b5ea620833a1991f32b3c (diff) |
Style improvements
Diffstat (limited to 'include/tests_boot_services')
-rw-r--r-- | include/tests_boot_services | 17 |
1 files changed, 9 insertions, 8 deletions
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}" |