Skip to content
Browse files

Added support for stident numbers, paid status

  • Loading branch information...
1 parent 0f4e89d commit 575546139fc4f7c267ac7779ca7e28cfa3f2dc78 @smillie committed
Showing with 59 additions and 18 deletions.
  1. +25 −18 gsparseldif
  2. +34 −0 gsuserinfo
View
43 gsparseldif
@@ -1,12 +1,13 @@
#! /usr/bin/awk -f
BEGIN {
- "perl -e 'printf qq{%d\n}, time/86400;'" | getline date;
- givenName = ""
- sn = ""
- mail = ""
- expired = ""
- #printf("First, Last, Email\n----------------------\n");
+ "perl -e 'printf qq{%d\n}, time/86400;'" | getline date;
+ givenName = ""
+ sn = ""
+ mail = ""
+ expired = ""
+ paid = ""
+ studentNo = ""
}
/^givenName: / {givenName=$2}
@@ -14,21 +15,27 @@ BEGIN {
/^sn: / {sn=$2}
/^mail: / {mail=$2}
/^shadowExpire: / {expired=$2}
+/^hasPaid: / {paid=$2}
+/^studentNumber: / {studentNo=$2}
/^dn: / {
- if (givenName !="" && expired < (date) && expired != "-1" && expired !="") printf("\033[1m\033[31m** EXPIRED **\033[0m\t")
- else if (givenName !="" && expired < (date+60) && expired != "-1" && expired !="") printf("\033[32m** EXPIRING **\033[0m\t")
- else if (givenName !="") printf("\t\t")
- if(givenName != "") printf("%s %s, %s\n",givenName,sn,mail)
+ if (givenName !="" && expired < (date) && expired != "-1" && expired !="") printf("\033[1m\033[41m** EXPIRED **\033[0m\t")
+ else if (givenName !="" && expired < (date+60) && expired != "-1" && expired !="") printf("\033[33m** EXPIRING **\033[0m\t", expired - date)
+ else if (givenName !="" && paid == "FALSE") printf("\033[31m** Not Paid **\033[0m\t")
+ else if (givenName !="") printf("\t\t")
+ if(givenName != "") printf("%s %s, %s, %s\n",givenName,sn,studentNo,mail)
- givenName = ""
- sn = ""
- mail = ""
- expired=""
+ givenName = ""
+ sn = ""
+ mail = ""
+ expired = ""
+ paid = ""
+ studentNo = ""
}
END {
- if (givenName !="" && expired < (date) && expired != "-1" && expired !="") printf("\033[1m\033[31m** EXPIRED **\033[0m\t")
- else if (givenName !="" && expired < (date+60) && expired != "-1" && expired !="") printf("\033[32m** EXPIRING **\033[0m\t")
- else if (givenName !="") printf("\t\t")
- if(givenName != "") printf("%s %s, %s\n",givenName,sn,mail)
+ if (givenName !="" && expired < (date) && expired != "-1" && expired !="") printf("\033[1m\033[41m** EXPIRED **\033[0m\t")
+ else if (givenName !="" && expired < (date+60) && expired != "-1" && expired !="") printf("\033[33m** EXPIRING **\033[0m\t", expired - date)
+ else if (givenName !="" && paid == "FALSE") printf("\033[31m** Not Paid **\033[0m\t")
+ else if (givenName !="") printf("\t\t")
+ if(givenName != "") printf("%s %s, %s, %s\n",givenName,sn,studentNo,mail)
}
View
34 gsuserinfo
@@ -0,0 +1,34 @@
+#! /usr/bin/awk -f
+
+BEGIN {
+ "perl -e 'printf qq{%d\n}, time/86400;'" | getline date;
+ givenName = ""
+ sn = ""
+ mail = ""
+ expired = ""
+ #printf("First, Last, Email\n----------------------\n");
+}
+
+/^givenName: / {givenName=$2}
+# /^sn: / {sn=$2" " $3}
+/^sn: / {sn=$2}
+/^mail: / {mail=$2}
+/^shadowExpire: / {expired=$2}
+/^dn: / {
+ if (givenName !="" && expired < (date) && expired != "-1" && expired !="") printf("\033[1m\033[31m** EXPIRED **\033[0m\t")
+ else if (givenName !="" && expired < (date+60) && expired != "-1" && expired !="") printf("\033[32m** EXPIRING **\033[0m\t")
+ else if (givenName !="") printf("\t\t")
+ if(givenName != "") printf("%s %s, %s\n",givenName,sn,mail)
+
+ givenName = ""
+ sn = ""
+ mail = ""
+ expired=""
+}
+
+END {
+ if (givenName !="" && expired < (date) && expired != "-1" && expired !="") printf("\033[1m\033[31m** EXPIRED **\033[0m\t")
+ else if (givenName !="" && expired < (date+60) && expired != "-1" && expired !="") printf("\033[32m** EXPIRING **\033[0m\t")
+ else if (givenName !="") printf("\t\t")
+ if(givenName != "") printf("%s %s, %s\n",givenName,sn,mail)
+}

0 comments on commit 5755461

Please sign in to comment.
Something went wrong with that request. Please try again.