#!/bin/bash qy="athrun ops qy" datadir=${1:-$HOME/Private/listdiff} if ! [[ -d "$datadir" ]]; then echo "Please create and initialize the data directory" echo "($datadir)" echo "and rerun this script." exit 1 fi cd "$datadir" queries=( "gaus" "glom" ) subjectname="$USER" while true; do printf "\n\n" date for query in ${queries[@]}; do for mod in "" "r"; do hmod=$mod if [ -z "$mod" ]; then hmod="nr"; fi $qy $query ${mod}user "$subjectname" -s | sort > $query-user-$hmod.txt $qy $query ${mod}kerberos "$subjectname@ATHENA.MIT.EDU" -s | sort > $query-kerb-$hmod.txt done done stat="$(git diff --stat)" for file in *.txt; do result="$(git diff "$file")" if [ -n "$result" ]; then zwrite -c "$subjectname-lists" -i "$file" "$subjectname" -m "$result" fi done git commit -a -m "$(printf "Regular list update: %s\n\n%s" "$(date)" "$stat")" sleep 5m done