X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=system-status;h=ddb5b738c28db81d1f4320ad10200de8b4f3f773;hb=a5d4a2af585b0eed9c613f3e1557b6c9c760d3de;hp=d6db7c3eb57b351c01b97c627376f55ad424e33f;hpb=313bf2239f766a5a1d060133131b477478873ad7;p=distro-setup diff --git a/system-status b/system-status index d6db7c3..ddb5b73 100755 --- a/system-status +++ b/system-status @@ -45,7 +45,10 @@ write-status() { chars+=("MAILPING!") fi - qlen=$(/usr/sbin/exiqgrep -o 60 -c -b | awk '{print $1}') + if ! qlen=$(/usr/sbin/exiqgrep -o 60 -c -b | awk '{print $1}'); then + # early in install process, we dont have permission yet for exiqgrep + qlen=$(sudo /usr/sbin/exiqgrep -o 60 -c -b | awk '{print $1}') + fi if ((qlen)); then chars+=("q $qlen") fi @@ -64,6 +67,8 @@ write-status() { if [[ -e $f ]]; then now=$(date +%s) fsec=$(stat -c%Y $f) + # the / 60 makes it 0-59 seconds less strict, +1 makes sure we + # dont have any false positives. fmin=$(( (fsec - now ) / 60 + 1 )) fminplus=$(( fmin + 60*24 )) # Filesystem files get copied, so find any newer than the last run. @@ -78,6 +83,7 @@ write-status() { if grep -qxF $HOSTNAME $x; then all_dirs+=( ${x%.hosts} ); fi done + # just because i forget a lot, -mmin -NUM means files modified <= NUM minutes ago if (( $(date -d "$(git log --diff-filter=ACR --format=%aD -1)" +%s) > fsec )) || \ [[ $(find ${all_dirs[@]} -mmin $fmin -type f -print -quit 2>/dev/null) ]]; then v conflink newer git or newer filesystem files