Changeset 2657 for trunk/server/fedora/config
- Timestamp:
- Dec 20, 2014, 2:47:51 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/fedora/config/etc/scripts/prune-mailq
r2609 r2657 7 7 $0 list-from 8 8 $0 list-to 9 $0 show-rand 9 $0 show-rand [from|to] [regex] 10 10 $0 email lockers... 11 11 $0 purge-from lockers... 12 12 $0 purge-to lockers..." 13 13 14 usage() { 15 echo "$usage" >&2; 16 exit 1 17 } 14 18 clean_locker() { 15 19 echo "${1%%@scripts.mit.edu}" … … 27 31 28 32 show_rand() { 29 files=$(ls /var/spool/postfix/deferred/?/* | shuf | head -n 3) 33 if [[ $# -eq 0 ]]; then 34 files=$(ls /var/spool/postfix/deferred/?/* | shuf | head -n 3) 35 else 36 match=$2 37 case "$1" in 38 from) dir=7;; 39 to) dir=8;; 40 *) usage;; 41 esac 42 msgids=$(mailq | tail -n +2 | grep -v '^ *(' | awk "BEGIN { RS = \"\" } (\$$dir ~ /$match/) { print \$1 }" | shuf | head -n 3) 43 files=$(for msgid in $msgids; do echo /var/spool/postfix/deferred/${msgid:0:1}/$msgid; done) 44 fi 30 45 for file in $files; do 31 46 echo ">>>> $file"; … … 99 114 list-from) list_from;; 100 115 list-to) list_to;; 101 show-rand) show_rand ;;116 show-rand) show_rand "$@";; 102 117 email) tmpl_email "$@";; 103 118 purge-from) purge_from "$@";; 104 119 purge-to) purge_to "$@";; 105 120 *) 106 echo "$usage" >&2; 107 exit 1 121 usage 108 122 ;; 109 123 esac
Note: See TracChangeset
for help on using the changeset viewer.