Ignore:
Timestamp:
Feb 16, 2015, 2:54:47 PM (10 years ago)
Author:
quentin
Message:
Allow specifying full e-mail addresses for purge-{from,to}
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/fedora/config/etc/scripts/prune-mailq

    r2658 r2670  
    1919clean_locker() {
    2020    echo "${1%%@scripts.mit.edu}"
     21}
     22
     23canonicalize_address() {
     24    if [[ "$1" == *@* ]]; then
     25        echo "$1"
     26    else
     27        echo "$1@scripts.mit.edu"
     28    fi
    2129}
    2230
     
    8896    fi
    8997    for locker in "$@"; do
    90         locker=$(clean_locker "$locker")
    91         echo "$locker..."
    92         mailq | tail -n +2 | grep -v '^ *(' | awk "BEGIN { RS = \"\" } (\$7 == \"$locker@scripts.mit.edu\") { print \$1 }" | tr -d '*!' | postsuper -d -
     98        address=$(canonicalize_address "$locker")
     99        echo "$address..."
     100        mailq | tail -n +2 | grep -v '^ *(' | awk "BEGIN { RS = \"\" } (\$7 == \"$address\") { print \$1 }" | tr -d '*!' | postsuper -d -
    93101        echo
    94102    done
     
    101109    fi
    102110    for locker in "$@"; do
    103         locker=$(clean_locker "$locker")
    104         echo "$locker..."
    105         mailq | tail -n +2 | grep -v '^ *(' | awk "BEGIN { RS = \"\" } (\$8 == \"$locker@scripts.mit.edu\" && \$9 == \"\") { print \$1 }" | tr -d '*!' | postsuper -d -
     111        address=$(canonicalize_address "$locker")
     112        echo "$address..."
     113        mailq | tail -n +2 | grep -v '^ *(' | awk "BEGIN { RS = \"\" } (\$8 == \"$address\" && \$9 == \"\") { print \$1 }" | tr -d '*!' | postsuper -d -
    106114        echo
    107115    done
Note: See TracChangeset for help on using the changeset viewer.