Add expired-account and notify-hook to git
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 23 Jan 2008 07:13:21 +0000 (02:13 -0500)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Wed, 23 Jan 2008 07:13:21 +0000 (02:13 -0500)
misc/expired-account [new file with mode: 0755]
misc/notify-hook [new file with mode: 0755]

diff --git a/misc/expired-account b/misc/expired-account
new file mode 100755 (executable)
index 0000000..9cacb86
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+name=$1
+email=$2
+shift 2
+
+tmp="$(tempfile)"
+trap "rm $tmp" 0
+exec >"$tmp"
+
+echo "From: Computer Science Club <ceo+expired@csclub.uwaterloo.ca>"
+echo "Reply-to: CSClub Exec <exec@csclub.uwaterloo.ca>"
+echo "To: $name <$email>"
+echo "Subject: [CSClub] Account Expiration"
+echo ""
+echo "Hello,
+
+We noticed that your Computer Science Club membership has expired. We would
+like to remind you of the many benifits of being a member of the club:
+
+* 2 GiB of disk quota
+* Web space
+* Email address
+* Shell account
+* Access to our library
+
+If you would like to renew your membership (the fee is \$2 per term), we have
+various methods of doing so:
+
+* Come by our office (MC 3036)
+* Send us a PayPal donation and send us the transaction id; see
+    http://csclub.uwaterloo.ca/about/donations for details
+* Mail us a cheque; here's our address:
+    Computer Science Club
+    Math & Computer 3036/3037
+    University of Waterloo
+    200 University Avenue West
+    Waterloo, ON  N3L 3G1
+    Canada
+
+If you have any questions, feel free to contact us by phone at
+(519) 888-4567 x33870, or by email at exec@csclub.uwaterloo.ca.
+
+Regards,
+
+The Computer Science Club"
+
+exec >&- 2>&-
+/usr/sbin/sendmail -t -f "ceo@csclub.uwaterloo.ca" < "$tmp"
diff --git a/misc/notify-hook b/misc/notify-hook
new file mode 100755 (executable)
index 0000000..499127b
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+prog=$1
+auth=$2
+shift 2
+
+tmp="$(tempfile)"
+trap "rm $tmp" 0
+exec >"$tmp"
+
+authrn="$(getent passwd "$auth" | awk -F: '{ print $5 }' | sed 's/,.*//')"
+
+echo "From: $prog <ceo+$prog@csclub.uwaterloo.ca>"
+echo "To: Membership and Accounts <ceo@csclub.uwaterloo.ca>"
+echo "Cc: $authrn <$auth@csclub.uwaterloo.ca>"
+
+if test "$prog" = addmember; then
+    user=$1 name=$2 dept=$3; shift 3
+    subj="New Member: $user"
+    test -z "$dept" && dept="things unknown"
+    body="Name: $name
+Account: $user
+Program: $dept
+Added by: $auth"
+
+elif test "$prog" = addclub; then
+    user=$1 name=$2; shift 2
+    subj="New Club Account: $user"
+    body="Club: $name
+Account: $user
+Added by: $auth"
+
+else
+    exit 1
+fi
+
+output=$(cat)
+
+echo "X-Auth-User: $auth"
+echo "X-New-User: $user"
+echo "X-New-Name: $name"
+echo "Subject: $subj"
+echo
+echo "$body" | fmt -s
+echo
+
+if test -n "$output"; then
+    echo
+    echo "$output"
+fi
+
+echo
+echo Your Friend,
+echo "$prog"
+
+exec >&- 2>&-
+/usr/sbin/sendmail -t -f "ceo@csclub.uwaterloo.ca" < "$tmp"