Changeset 2609 for trunk/server/fedora/config/etc/scripts
- Timestamp:
- Sep 9, 2014, 8:35:03 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/fedora/config/etc/scripts/prune-mailq
r2426 r2609 5 5 6 6 usage="Usage: 7 $0 list 7 $0 list-from 8 $0 list-to 8 9 $0 show-rand 9 10 $0 email lockers... 10 $0 purge lockers..." 11 $0 purge-from lockers... 12 $0 purge-to lockers..." 11 13 12 14 clean_locker() { … … 14 16 } 15 17 16 list() { 17 echo "Top twenty users by number of queued messages:" 18 list_from() { 19 echo "Top twenty senders by number of queued messages:" 20 mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { print $7 }' | sort | uniq -c | sort -n | tail -n 20 21 } 22 23 list_to() { 24 echo "Top twenty recipients by number of queued messages:" 18 25 mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { print $8 }' | sort | uniq -c | sort -n | tail -n 20 19 26 } … … 31 38 sender=${SSH_GSSAPI_NAME%%/*} 32 39 if [[ $# -eq 0 ]]; then 33 echo "Please specif ica locker to generate template for." >&240 echo "Please specify a locker to generate template for." >&2 34 41 exit 1 35 42 fi … … 57 64 } 58 65 59 purge () {66 purge_from() { 60 67 if [[ $# -eq 0 ]]; then 61 echo "Please specific a locker to purge emails for." >&2 68 echo "Please specify a locker to purge emails from" >&2 69 exit 1 70 fi 71 for locker in "$@"; do 72 locker=$(clean_locker "$locker") 73 echo "$locker..." 74 mailq | tail -n +2 | grep -v '^ *(' | awk "BEGIN { RS = \"\" } (\$7 == \"$locker@scripts.mit.edu\") { print \$1 }" | tr -d '*!' | postsuper -d - 75 echo 76 done 77 } 78 79 purge_to() { 80 if [[ $# -eq 0 ]]; then 81 echo "Please specify a locker to purge emails to" >&2 62 82 exit 1 63 83 fi … … 77 97 78 98 case "$op" in 79 list) list;; 99 list-from) list_from;; 100 list-to) list_to;; 80 101 show-rand) show_rand;; 81 102 email) tmpl_email "$@";; 82 purge) purge "$@";; 103 purge-from) purge_from "$@";; 104 purge-to) purge_to "$@";; 83 105 *) 84 106 echo "$usage" >&2;
Note: See TracChangeset
for help on using the changeset viewer.