qy="athrun ops qy"
-#queries="get_ace_use get_lists_of_member"
+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"
-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 > data/$query-user-$hmod.txt
- $qy $query ${mod}kerberos "$subjectname@ATHENA.MIT.EDU" -s | sort > data/$query-kerb-$hmod.txt
+
+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
-done
-cd "$(dirname "$0")/data/"
+ stat="$(git diff --stat)"
-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
-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")"
-git commit -a -m "$(printf "Regular list update: %s\n\n%s" "$(date)" "$stat")"
+ sleep 5m
+done