Thread View: alt.privacy.anon-server
2 messages
2 total messages
Started by inwtx
Thu, 23 Jan 2020 18:45
mailq delete script
Author: inwtx
Date: Thu, 23 Jan 2020 18:45
Date: Thu, 23 Jan 2020 18:45
73 lines
2449 bytes
2449 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
If you want to delete just the eurovibes.org mail stuck
in your mailq, you can use the script below:
#!/bin/bash
#
# DeleteMailqByName.sh
#
# This scripts deletes entries in the mailq via a name in the mailq record.
# Be exact on the text to search for (eurovibes.org, etc).
# Format: ./DeleteMailqByName.sh eurovibes.org
filePath=${0%/*} # current file path
inputrem="$1"
if [[ $1 == "" ]]; then
echo "Address of remailer required!"
exit 0
fi
mailq > $filePath/DeleteMailqByName.txt
cat /dev/null > $filePath/DeleteMailqByName.txt2
sed -i "1d" $filePath/DeleteMailqByName.txt
sed -i '$d' $filePath/DeleteMailqByName.txt
while read line1; do
if [[ ! $line1 = "" ]]; then
tr -d '\012' <<<$line1 >> $filePath/DeleteMailqByName.txt2
else
echo "$line1" >> $filePath/DeleteMailqByName.txt2
fi
done< $filePath/DeleteMailqByName.txt
awk -vS= '$inputrem' $filePath/DeleteMailqByName.txt2 > $filePath/DeleteMailqByName.txt3
awk '{ print $1 }' $filePath/DeleteMailqByName.txt3 > $filePath/DeleteMailqByName.txt4
sed -i 's/\*//g' DeleteMailqByName.txt4
while read line1; do
postsuper -d $line1
done< $filePath/DeleteMailqByName.txt4
rm $filePath/DeleteMailqByName.txt
rm $filePath/DeleteMailqByName.txt2
rm $filePath/DeleteMailqByName.txt3
rm $filePath/DeleteMailqByName.txt4
exit 0
-----BEGIN PGP SIGNATURE-----
iF4EAREIAAYFAl4p6VYACgkQhU7fz9hYXBPDTAD+LJ8e1ECoTtUTzNPlXdBbWHx9
09v1OzSthd1euS1kSIoA/jcFO1Q4vpWcjRl7dmQOOW+2nAb6cZYOPE6oozoK+F+h
=WVrt
-----END PGP SIGNATURE-----
--
pub 2048D/D8585C13
inwtx.net/pubkey.txt
--
pub 2048D/9720 86F3 274F 9AED AEFD 8E75 854E DFCF D858 5C13
inwtx.net/gpg_pubkey.txt
inwtx.net/NaClbox_pubkey.txt
Re: mailq delete script
Author: elvis-85781
Date: Sat, 25 Jan 2020 00:34
Date: Sat, 25 Jan 2020 00:34
108 lines
3759 bytes
3759 bytes
On 2020-01-23, inwtx <noreply@inwtx.net> wrote:
>
> If you want to delete just the eurovibes.org mail stuck
> in your mailq, you can use the script below:
>
>
> #!/bin/bash
> #
> # DeleteMailqByName.sh
> #
> # This scripts deletes entries in the mailq via a name in the mailq record.
> # Be exact on the text to search for (eurovibes.org, etc).
> # Format: ./DeleteMailqByName.sh eurovibes.org
>
>
> filePath=${0%/*} # current file path
>
> inputrem="$1"
>
> if [[ $1 == "" ]]; then
> echo "Address of remailer required!"
> exit 0
> fi
>
> mailq > $filePath/DeleteMailqByName.txt
>
> cat /dev/null > $filePath/DeleteMailqByName.txt2
>
> sed -i "1d" $filePath/DeleteMailqByName.txt
> sed -i '$d' $filePath/DeleteMailqByName.txt
>
> while read line1; do
> if [[ ! $line1 = "" ]]; then
> tr -d '\012' <<<$line1 >> $filePath/DeleteMailqByName.txt2
> else
> echo "$line1" >> $filePath/DeleteMailqByName.txt2
> fi
> done< $filePath/DeleteMailqByName.txt
>
> awk -vS= '$inputrem' $filePath/DeleteMailqByName.txt2 > $filePath/DeleteMailqByName.txt3
>
> awk '{ print $1 }' $filePath/DeleteMailqByName.txt3 > $filePath/DeleteMailqByName.txt4
>
> sed -i 's/\*//g' DeleteMailqByName.txt4
>
> while read line1; do
> postsuper -d $line1
> done< $filePath/DeleteMailqByName.txt4
>
> rm $filePath/DeleteMailqByName.txt
> rm $filePath/DeleteMailqByName.txt2
> rm $filePath/DeleteMailqByName.txt3
> rm $filePath/DeleteMailqByName.txt4
>
> exit 0
That has some similarity to a post from 2015 (not by me).
Here is a script I wrote just for such pesky mailq entries. Put it in a file /etc/deletemailq.sh, 'chmod 755 deletemailq.sh' it and run it like this:
./deletemailq.sh pinger@anonusa.net
It will only pick out the pinger@anonusa.net mailq records and remove them.
#!/bin/bash
#
# deletemailq.sh
# Delete mailq by string within mailq record
# ./deletemailq.sh pinger@anonusa.net
#
export PATH=$PATH:/sbin
export PATH=$PATH:/bin
export PATH=$PATH:/usr/sbin
filePath=${0%/*} # current file path
remailerid="$1"
if [ ${#remailerid} = 0 ]; then
echo "Remailer name or address must be appended to end for this process to start!"
exit 0
fi
mailq > $filePath/tempmq.txt
sed -i '/-Arrival Time-/d' $filePath/tempmq.txt # rid of title and trailer lines
sed -i '/Kbytes in/d' $filePath/tempmq.txt
while read -r line; do
var1stline=$line # 1st line
read -r line
var2ndline=$line #2nd line
read -r line
var3rdline=$line #3rd line
read -r line # blank line between
mailqstr="$var1stline $var2ndline $var3rdline" # all 3 lines merged into one
if [[ $(grep -c $remailerid <<<$mailqstr) -gt 0 ]]; then # is passed string in mailq record?
qID=$(cut -d' ' -f1 <<<$mailqstr) # extract 'Queue ID' to delete
postsuper -d "$qID" # yes - delete it
fi
done < $filePath/tempmq.txt
rm $filePath/tempmq.txt
exit 0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads