File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
server/fedora/config/etc/scripts Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ usage="Usage:
9
9
$0 show-rand [from regex|to regex]
10
10
$0 email lockers...
11
11
$0 purge-from lockers...
12
- $0 purge-to lockers..."
12
+ $0 purge-from-re regexes...
13
+ $0 purge-to lockers...
14
+ $0 purge-to-re regexes..."
13
15
14
16
usage () {
15
17
echo " $usage " >&2 ;
@@ -102,6 +104,18 @@ purge_from() {
102
104
done
103
105
}
104
106
107
+ purge_from_re () {
108
+ if [[ $# -eq 0 ]]; then
109
+ echo " Please specify a regex to purge emails from" >&2
110
+ exit 1
111
+ fi
112
+ for re in " $@ " ; do
113
+ echo " $re "
114
+ mailq | tail -n +2 | grep -v ' ^ *(' | awk " BEGIN { RS = \"\" } (\$ 7 ~ \" $re \" ) { print \$ 1 }" | tr -d ' *!' | postsuper -d -
115
+ echo
116
+ done
117
+ }
118
+
105
119
purge_to () {
106
120
if [[ $# -eq 0 ]]; then
107
121
echo " Please specify a locker to purge emails to" >&2
@@ -115,6 +129,18 @@ purge_to() {
115
129
done
116
130
}
117
131
132
+ purge_to_re () {
133
+ if [[ $# -eq 0 ]]; then
134
+ echo " Please specify a regex to purge emails to" >&2
135
+ exit 1
136
+ fi
137
+ for re in " $@ " ; do
138
+ echo " $re "
139
+ mailq | tail -n +2 | grep -v ' ^ *(' | awk " BEGIN { RS = \"\" } (\$ 8 ~ \" $re \" && \$ 9 == \"\" ) { print \$ 1 }" | tr -d ' *!' | postsuper -d -
140
+ echo
141
+ done
142
+ }
143
+
118
144
op=${1:- }
119
145
120
146
# We want to go ahead and show the usage message if there are no args, so
@@ -127,7 +153,9 @@ case "$op" in
127
153
show-rand) show_rand " $@ " ;;
128
154
email) tmpl_email " $@ " ;;
129
155
purge-from) purge_from " $@ " ;;
156
+ purge-from-re) purge_from_re " $@ " ;;
130
157
purge-to) purge_to " $@ " ;;
158
+ purge-to-re) purge_to_re " $@ " ;;
131
159
* )
132
160
usage
133
161
;;
You can’t perform that action at this time.
0 commit comments