* Cleaning script for nnml hierarchy
@ 1997-03-19 15:25 François Pinard
0 siblings, 0 replies; only message in thread
From: François Pinard @ 1997-03-19 15:25 UTC (permalink / raw)
Hi, people.
Just in case it interests a few of you, I wrote a Perl script to clean
out dead directories and mailgroups out of an nnml hierarchy. I consider
a group removable if it contains no article at all (everything has been
expired, maybe a while ago).
To use it, you have to:
* assume the risk that if the script does something you do not like,
you'll live with the results and not shout after me,
* unpack the following archive (uuencoded because it has a few Latin-1
characters in it, and gzipped because uuencoded :-),
* change the $SPOOL definition to point to your spool (mine is ~/.mail),
* execute `perl clean-nnml',
* in the Group buffer, do `g' for refreshing the nnml group list and `b' for
removing the (now) bogus groups,
* write to me to share your ideas about what I should have done better.
It is a quick hack, really, which worked for my own needs.
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1997-03-19 10:16 EST by <pinard@icule>.
# Source directory was `/home/icule/pinard/bin'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 2942 -rwxr-x--x clean-nnml
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh00861; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= clean-nnml ==============
if test -f 'clean-nnml' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'clean-nnml' '(file already exists)'
else
$echo 'x -' extracting 'clean-nnml' '(gzipped)'
sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 _sh00861/gzi
M'XL(`,TY+S,"`X56[5+;1A3];3W%Q:CX`UF"_,E0)TPRB6DR0S`36CH=/MQ%
M6IL=I%UU)0,>8]ZG3];7Z-T/R9)MP..QK-7=L^>>O?=HM[>":2:#6(0D#FX8
M#U(J8^CU&NJS#;UN[Q0'\.+0>Q)#DS[2$#9..0-W#]QNTP'\L#'L]1UG&[[$
ME'"8ID"3-)\!YTD,$RFF:0:$1Q`)$/DME9"P.`)<@44D9X)GOIHKTIEDD]L<
M_H7]@X/W<"0IA3,QSA^(I'`DIMQ$>_"=AVK&D23\/\$R.&6<R`@^I/KZB4GA
M3Q/!<TE)[(?DT(.$R$RC^H[CGIT.A\?P$=S!R?F\]6WX8]!:@`^MP$\(BUN8
MB3L\'_P\_S[X<W1T_/DW#-WO.^[)\&3PX_3WOXJQ=QB(U#@T?U(2,3X!$N;L
MGL*8Q=3W_4O>[#LBI1S:WSZ??#T>>-`T:P<FL-F!IR>(&(5FMPM?".<B!^0<
M03VL[SS<(B2T/QB<PXXS+W1O!]?MBVNXVNU`^V*O=W"U"_8RZ[A!1X?-G89K
MH.;N_D(ECM35@X7^I7%&BSB33Q?.<M1V0HN,8L8I7/[MCEHZ*3-WX82QR"@8
M4BB0"1XE(F)C1B-<:*^4Z"R?1C.ED:Z)+!4B?D&B,>.%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 0751 'clean-nnml' ||
$echo 'restore of' 'clean-nnml' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'clean-nnml:' 'MD5 check failed'
8332e64eec8ef6baf08a26805eb60e47 clean-nnml
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'clean-nnml'`"
test 2942 -eq "$shar_count" ||
$echo 'clean-nnml:' 'original size' '2942,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh00861
exit 0
--
François Pinard ``Vivement GNU!'' pinard@iro.umontreal.ca
Support Programming Freedom, join our League! Ask lpf@lpf.org for info!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-03-19 15:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-19 15:25 Cleaning script for nnml hierarchy François Pinard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).