chars+=("MAILPING!")
fi
+ qlen=$(/usr/sbin/exim -bpc)
+ if ((qlen)); then
+ chars+=("q $qlen")
+ fi
+
+ if ! make -q ~/.local/distro-begin || [[ $(<~/.local/distro-begin) != 0 ]]; then
+ chars+=("DISTRO-BEGIN!")
+ fi
+
+ if ! make -q ~/.local/distro-end || [[ $(<~/.local/distro-end) != 0 ]]; then
+ chars+=("DISTRO-END!")
+ fi
+
+ f=~/.local/conflink
+ if [[ -e $f ]]; then
+ cd /b/ds
+ now=$(date +%s)
+ fsec=$(stat -c%Y $f)
+ fmin=$(( (fsec - now ) / 60 + 1 ))
+ fminplus=$(( fmin + 60*24 ))
+ # Filesystem files get copied, so find any newer than the last run.
+ # The rest are hueristics:
+ # Given the last time we added a file in git, is that newer than the last conflink run.
+ # Given new files not added to git, were they modified more recently than the last conflink? but,
+ # push their modification time back by a day so we can develop them before needing to add them to git.
+ if (( $(date -d "$(git log --diff-filter=ACR --format=%aD -1)" +%s) > fsec )) || \
+ [[ $(find {/a/bin/ds,/p/c}{/filesystem,/machine_specific/$HOSTNAME/filesystem} -mmin $fmin -type f -print -quit 2>/dev/null) ]] \
+ || [[ $(find $(git ls-files -o --exclude-standard) -mmin $fminplus -type f -print -quit) ]]; then
+ chars+=("CONFLINK!")
+ fi
+ fi
+
+ if [[ ! -e $f || $(<$f) != 0 ]]; then
+ chars+=("CONFLINK!")
+ fi
+
+
## Clean the paniclog, but only up to 4 times per day, or else we
## should investigate.
loglog=/tmp/panicloglog-$(date --rfc-3339=date)
## check if last snapshot was within an hour
vol=o
- snaps=(/mnt/root/btrbk/$vol.20*)
+ # this section generally copied from btrbk scripts, but
+ # this part modified to speed things up by about half a second.
+ # I'm not sure if its quite as reliable, but it looks pretty safe.
+ # Profiled it using time and also adding to the top of the file:
+ # set -x
+ # PS4='+ $(date "+%2N") '
+ snaps=($(ls -1avdr /mnt/root/btrbk/$vol.20*|head -n1))
now=$(date +%s)
maxtime=0
for s in ${snaps[@]}; do