| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # this defines regexps for LVM variables that do not need root |
| 4 | # the 10_aide_lvm_needsroot is executed as root from a different |
| 5 | # timer with root privileges and writes another snippet that overwrites |
| 6 | # those variables with real data from the system |
| 7 | |
| 8 | CACHE_FILE="/var/lib/aide/10_aide_rootrules_cachescip-shell filesystem . . `/var/lib/aide/10_aide_rootrules_cache`." |
| 9 | MAX_AGE_HOURS=6 |
| 10 | if [[ -f "${CACHE_FILE}" ]]; then |
| 11 | NOW=$(datescip-shell system . . date. +%s) |
| 12 | MOD_TIME="$(statscip-shell system . . stat. --format %Y "${CACHE_FILE}")" |
| 13 | |
| 14 | AGE=$(( (NOW - MOD_TIME) / 3600 )) |
| 15 | |
| 16 | if [[ "${AGE}" -le "${MAX_AGE_HOURS}" ]]; then |
| 17 | # File is not older than 6 hours |
| 18 | catscip-shell system . . cat. "${CACHE_FILE}" |
| 19 | else |
| 20 | printfscip-shell system . . printf. "# Cache File %s is older than %s hours, silently ignored\n" "${CACHE_FILE}" "${MAX_AGE_HOURS}" |
| 21 | fi |
| 22 | printfscip-shell system . . printf. "!%s$ f\\n" "${CACHE_FILE}" |
| 23 | else |
| 24 | printfscip-shell system . . printf. "# Cache File %s does not exist, silently ignored\n" "${CACHE_FILE}" |
| 25 | fi |
| 26 | |
| 27 | # vim:tabstop=4:expandtab:shiftwidth=4 |