|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Subject: Small utility
From: Varadi Gabor (varadi
dust-bin.mis.matav.hu)Date: Tue Apr 04 2000 - 08:03:17 CDT
- Next message: Ralf Hildebrandt: "Re: How to tell NeoMail is a Trusted User in Postfix?"
- Previous message: Ralf Hildebrandt: "Re: 8 to 7 bit conversions (confused and slightly off topic)"
- Next in thread: Ralf Hildebrandt: "Re: Small utility"
- Reply: Ralf Hildebrandt: "Re: Small utility"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I'm writting small utility for postfix.
Delete mail/queue file in spool directory.
----cut----cut----cut----
#!/bin/sh
#
# Like all GNU software, grep is distritubed under the terms
# of the GNU General Public License, version 2. On Debian/GNU Linux
# system you can find a copy of this license in /usr/doc/copyright/GPL'.
#
# varadi
mithrandir.hu
#
#----------------------------------------------------------------------------
function header () {
if [ ! -z "`head --bytes=$hs $* | postcat 2>/dev/zero`" ]; then
head --bytes=$hs $* | postcat 2>/dev/zero |\
awk 'BEGIN { i=0; print "========================================"; }
$1 ~ /^\*\*\*/ { i=0; }
{ if(i == 1) print $0; }
$0 ~ /^\*\*\* ENVELOPE RECORDS/ { i=1; }
END { print "----------------------------------------"; } '
fi
}
#----------------------------------------------------------------------------
postfix stop 2>/dev/zero
echo -e "\n\r **** STOPING MAIL SYSTEM ****\n\n"
qd=`postconf queue_directory | awk '{print $3}'`
hs=`postconf header_size_limit | awk '{print $3+int($3/15)}'`
qf=`mailq 2>/dev/zero | awk '$1 ~ /^[0-9A-F][0-9A-F][0-9A-F]/ {print $1}'`
if [ ! -z "$qf" ]; then
bb=0
for i in $qf; do
bb=$[$bb+1]
echo -en "Counting mail in $dq ($bb) \r"
done
echo -en "\r "
echo -en " \r"
aa=1
for i in $qf; do
header `find $qd -name $i 2>/dev/zero`
read -p "Delete [$i] entry (y/n) [$aa of $bb]' ::>" xdel
echo -en "\r"
if [ "$xdel" == "y" -o "$xdel" == "Y" ]; then
rm -f `find $qd -name $i 2>/dev/zero`
fi
aa=$[$aa+1]
done
else
echo "Empty mailq in $qd"
fi
postfix start 2>/dev/zero
echo -e "\n\n\r **** STARTING MAIL SYSTEM ****\n\n"
----cut----cut----cut----
-- [End of message] Varadi Gabor
- Next message: Ralf Hildebrandt: "Re: How to tell NeoMail is a Trusted User in Postfix?"
- Previous message: Ralf Hildebrandt: "Re: 8 to 7 bit conversions (confused and slightly off topic)"
- Next in thread: Ralf Hildebrandt: "Re: Small utility"
- Reply: Ralf Hildebrandt: "Re: Small utility"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]