Thread View: news.software.nntp
6 messages
6 total messages
Started by Steve Howie
Wed, 19 Jan 1994 19:55
Active.times
Author: Steve Howie
Date: Wed, 19 Jan 1994 19:55
Date: Wed, 19 Jan 1994 19:55
19 lines
1569 bytes
1569 bytes
I created a newsgroup in INN 1.4 using ctlinnd, deleted it, then recreated it. It ended up that there were two entries in the active.times file on our INN server for the same newsgroup. This caused some of our TIN users to be prompted twice to see if they wanted to subscribe to that group. It doesn't appear that the active.times entry for the group is deleted when the actual newsgroup is deleted. Is this a bug/feature or nothing to worry about? Just curious.... Scotty -- -- ========================================================================= Steve Howie | email: showie@uoguelph.ca Computing and Comm. Services | Fax: (519) 763-6143 University of Guelph | Phone: (519) 824-4120 x2556 Guelph, Ontario CANADA N1G 2W1 | If its not Scottish it's C-r-r-raaaaaaaaaapppp!!
Removing newsgroups on an INN server (was Re: Active.times)
Author: Bryan Howard
Date: Wed, 19 Jan 1994 20:50
Date: Wed, 19 Jan 1994 20:50
29 lines
2318 bytes
2318 bytes
showie@uoguelph.ca (Steve Howie) writes:
> ... It
> doesn't appear that the active.times entry for the group is deleted when
> the actual newsgroup is deleted. Is this a bug/feature or nothing to worry
> about? Just curious....
Yes, there has been a small amount of discussion about what isn't
being done when newsgroups are removed on a system running INN.
Someone suggested that it might be nice for someone to write a script
to make sure it all happened in a coordinated manner. I was thinking
about doing just that, but I need some input as to what all needs to
be done. The above message just added another task to my growing
list. Any other help would be appreciated.
a) ctlinnd rmgroup defunct.news.group.name
b) rm -rf ~news/defunct/news/group/name
c) remove any directories in the above path which are now left empty
d) remove the entry for defunct.news.group.name from active.times
e) consider the merits of removing the entries from the history
database - would have to at least throttle innd during this
operation, probably better to just let expire complain a little.
Anyone care to comment, add stuff, or tell me they've already written
the thing?
--
{Bryan}
Bryan Howard, VMS & U*ix System Mangler
JPL Section 393, Pasadena, CA, USA <bryan@solstice.jpl.nasa.gov>
Re: Removing newsgroups on an INN server (was Re: Active.times)
Author: Rich Salz
Date: Thu, 20 Jan 1994 14:38
Date: Thu, 20 Jan 1994 14:38
9 lines
1129 bytes
1129 bytes
In <BRYAN.94Jan19125036@solstice.jpl.nasa.gov> bryan@solstice.jpl.nasa.gov (Bryan Howard) writes: >b) rm -rf ~news/defunct/news/group/name Not quite, since removing "news.admin" because "news.admin.misc" was created would be bad. I want to include such a script in 1.5; it would help if I someone else sent me a good one. /r$
Re: Active.times
Author: Tom Limoncelli
Date: Thu, 20 Jan 1994 21:43
Date: Thu, 20 Jan 1994 21:43
22 lines
1928 bytes
1928 bytes
In <2hk37f$mv5@nermal.cs.uoguelph.ca> showie@uoguelph.ca (Steve Howie) writes: >I created a newsgroup in INN 1.4 using ctlinnd, deleted it, then recreated >it. It ended up that there were two entries in the active.times file on >our INN server for the same newsgroup. This caused some of our TIN users >to be prompted twice to see if they wanted to subscribe to that group. It >doesn't appear that the active.times entry for the group is deleted when >the actual newsgroup is deleted. Is this a bug/feature or nothing to worry >about? Just curious.... The line should not be deleted when the newsgroup is deleted. However, the "newgroup"s script should remove any redundent entries as it adds the new one. INN doesn't do this right now. Does C News do this? Tom -- Tom Limoncelli -- tal@warren.mentorg.com (work) -- tal@plts.org (play) "Psst! Hey, Anthony! Y'know what I | Disclaimer: I do not like about existing?" "Uh... uh... what?" | speak for Mentor Graphics. "Possessing a physical extension." -TSA |
Re: Removing newsgroups on an INN server (was Re: Active.times)
Author: Tim Rosmus
Date: Fri, 21 Jan 1994 17:48
Date: Fri, 21 Jan 1994 17:48
98 lines
4448 bytes
4448 bytes
In <2hm51qINN8cn@rodan.UU.NET> rsalz@uunet.uu.net (Rich Salz) writes:
>In <BRYAN.94Jan19125036@solstice.jpl.nasa.gov> bryan@solstice.jpl.nasa.gov (Bryan Howard) writes:
>>b) rm -rf ~news/defunct/news/group/name
>Not quite, since removing "news.admin" because "news.admin.misc" was
>created would be bad.
>I want to include such a script in 1.5; it would help if I someone else
>sent me a good one.
> /r$
Well what the heck.... Here's what I use, small, not pretty, but it works.
Toss it, trash it, whatever.
I modified the following lines in .../bin/control/rmgroup to call the following
script for rmgroup messages. For manual use, just use as is.
## Do the work.
#ctlinnd -s rmgroup "$1"
/usr/lib/news/bin/delgroup "$1"
============== CUT =========================
#!/usr/local/bin/perl
die "Usage: delgroup group\n" unless $#ARGV == 0;
$spool = "/usr/spool/news";
$group = $ARGV[0]; # some.news.group
@agrp = split(/\./, $group); # Put each component of group into array.
($spltgrp = $ARGV[0]) =~ tr/\./\//; # translate . -> /
$fullp = $spool . "/" . $spltgrp; #/usr/spool/news/some/news/group
# Remove it from the active file.
print "Removing group ", $group, "\n";
system("/usr/lib/news/bin/ctlinnd rmgroup $group");
print "Removing directory tree for ", $group, "\n";
# cd into the newsgroup if it's there
die "No such directory: $!\n" unless chdir($fullp);
$baseflag = 1; # set for last part of some.news.group
$i = $#agrp; # number of components on newsgroup name
while ($i >= 0) {
$dflag = 0; # directory flag
@dirs = (); # directory array
opendir(OD, ".");
@dirs = readdir(OD); # read all files into array
# Look at each entry in the directory
for ($x = 0; $x <= $#dirs; $x++) {
$_ = $dirs[$x];
next if (/^\.$/ || /^\.\.$/); # skip . and ..
# if there is a subdir in this group, set a flag so we don't
# remove anything else except the files in this group.
if (-d) {
$dflag++;
} else {
# If we're in the last component of the news group, remove
# all files within
# If we've gone up one dir from the base, and there are files
# there, then we're done as this may be another valid group.
if ($baseflag && -f) {
unlink($_);
} else {
exit(0);
}
}
}
closedir(OD);
# if we found subdirs in this newsgroup directory, we're all done.
if ($dflag) {
exit(0);
}
# Go up one.
chdir("..");
# IF we are still at the base component of the group, no directories
# were found in the group, and all files have been removed, then
# go ahead and remove the last component of the group (directory)
#
# If we've gone up one directory from the last, and there are no
# other directories in there, then go ahead and remove it.
if ($baseflag || ($i < $#agrp)) {
print " Removing ", $agrp[$i], "\n";
rmdir($agrp[$i]);
} else {
exit(0);
}
# We'ew now on our way up, so reset the base flag. (first time)
$i--;
$baseflag = 0;
}
--
Internet: <tim@mdd.comm.mot.com> | Tim Rosmus (Sys Analyst)
Motorola-X400-ID: <ctr001@email.mot.com> | Motorola - Wireless Data Group
UUCP: <....uunet!mdisea!tim> | 19807 North Creek Parkway
FAX: < 206 - 487 - 5800 > | Bothell, WA USA (206) 487-5928
Re: Removing newsgroups on an INN server (was Re: Active.times)
Author: Joe Greco
Date: Tue, 25 Jan 1994 16:36
Date: Tue, 25 Jan 1994 16:36
224 lines
6595 bytes
6595 bytes
In news.software.nntp article <2hm51qINN8cn@rodan.uu.net>, rsalz@uunet.uu.net (Rich Salz) wrote:
:I want to include such a script in 1.5; it would help if I someone else
:sent me a good one.
I sent the following to Rich. I took my "removegroup" script and reworked
it to be more portable and INN-ish, and may have introduced a hidden bug or
two in the process(?) ;-) but it works well.
Subject: INN-compatible removegroup script
To: rsalz@uunet.uu.net
Date: Fri, 21 Jan 94 18:03:00 CST
Hi all,
What follows is a version of a removegroup(s) script that I've been using.
I went through this afternoon and removed dependencies for my system, so it
should run with little or no modification.
It will:
1) lock files and pause INN to prevent confusion
2) hit INN with a rmgroup
3) delete the entries from "newsgroups" and "active.times"
4) delete the news articles
5) delete the news overview database for the group
6) Try to do rudimentary directory pruning (possibly not very portably).
7) (my personal pet peeve about a lot of things) It will delete a LOT OF
GROUPS AT ONCE if specified on the command line (although it will thrash
around with the newsgroups and active.times files)
I do not promise that it is bug free or even correct, it simply works for
me. You are welcome to use it in any way, shape, or form, provided of
course that I get credit for the initial revision. I'd also like to hear of
any corrections or enhancements!
Enjoy,
.. Joe
-------------------------------------------------------------------------------
Joe Greco - Systems Administrator jgreco@ns.sol.net
Solaria Public Access UNIX - Milwaukee, WI 414/342-4847
#! /bin/sh -
#
# Script to remove one or more newsgroups.
#
# BUGS:
# We should probably log the use of this script someplace...
# The path to the overview data is hardwired since there is no hook for this
# in innshellvars.
# The path to the news spool is hardwired since there is no hook for this
# in innshellvars.
# A more portable way to delete an empty directory could be found. Works
# for me though.
# Doesn't delete pathnames from the history file.
# No command-line options. :-/ Although you probably always want to do the
# same things each time anyways.
#
# removegroup <groupname>
#
# Joe Greco <jgreco@ns.sol.net>
#
# 940103 Initial translation to INN
# 940120 Cleanups
## =()<. @<_PATH_SHELLVARS>@>()=
. /usr/local1/news/innshellvars
# Some defaults.
DOACTIVETIMES=true
DONEWSGROUPS=true
DODELETE=true
DORMDIR=true
DODELETEOVER=true
PROGNAME=`basename $0`
OVERVIEWDIR=/var/spool/news
OVERVIEW=.overview
SPOOL=/var/spool/news
# Check who is running this.
if [ "${NEWSUSER}" != "`whoami`" ]; then
echo "${PROGNAME}: only ${NEWSUSER} wants to run ${PROGNAME}." 1>&2
exit 1
fi
# Don't run if news.daily is active, just in case.
if [ -f "${DAILY}" ]; then
echo "${PROGNAME}: news.daily in progress." 1>&2
exit 1
fi
# Pause INN so that it doesn't hash what we are doing to newsgroups or
# active.times.
INNMODE="${PROGNAME}[$$] deleting groups"
ctlinnd -s pause "${INNMODE}"
# Lock the newsgroups file.
if ${DONEWSGROUPS} ; then
NLOCK=${LOCKS}/LOCK.newsgroups
NTEMP=${TMPDIR}/newsgroups.new
PID=$$
TRY=0
MAXTRY=60
export NLOCK MAXTRY PID LOGFILE TRY NTEMP
while [ ${TRY} -lt ${MAXTRY} ]; do
shlock -p ${PID} -f ${NLOCK} && break
sleep 2
TRY=`expr ${TRY} + 1`
done
# Did we catch the lock?
test ${TRY} -lt ${MAXTRY} || {
echo "${PROGNAME}: newsgroups locked by" `cat ${NLOCK}` 1>&2
exit 1
}
rm -f ${NTEMP}
fi
# Lock the active.times file (does this need to be done?).
if ${DOACTIVETIMES} ; then
ALOCK=${LOCKS}/LOCK.active.times
ATEMP=${TMPDIR}/active.times.new
PID=$$
TRY=0
MAXTRY=60
export ALOCK MAXTRY PID LOGFILE TRY ATEMP
while [ ${TRY} -lt ${MAXTRY} ]; do
shlock -p ${PID} -f ${ALOCK} && break
sleep 2
TRY=`expr ${TRY} + 1`
done
# Did we catch the lock?
test ${TRY} -lt ${MAXTRY} || {
echo "${PROGNAME}: active.times locked by" `cat ${ALOCK}` 1>&2
exit 1
}
rm -f ${ATEMP}
fi
while [ "$*" ]; do
grep "^$1 " ${ACTIVE} > /dev/null 2>&1 || {
# Group does not exist
echo "${PROGNAME}: ${1} not found" 1>&2
shift
continue
}
# Do the work.
ctlinnd -s rmgroup "$1"
# Remove the newsgroups line.
if ${DONEWSGROUPS} ; then
${EGREP} -v "^$1[ ]" < ${NEWSGROUPS} > ${NTEMP}
cat ${NTEMP} > ${NEWSGROUPS}
fi
# Remove the active.times line.
if ${DOACTIVETIMES} ; then
${EGREP} -v "^$1[ ]" < ${ACTIVETIMES} > ${ATEMP}
cat ${ATEMP} > ${ACTIVETIMES}
fi
DOTTOSLASH="`echo $1 | sed 's:\.:/:g'`"
#DOTTOSLASH="`echo $1 | tr \. \/`"
# Delete the spool articles.
if ${DODELETE} ; then
FILEDIR="${SPOOL}/${DOTTOSLASH}"
# Incremental delete in case we have a lot of files.
(cd ${FILEDIR}; rm -f [1-5][0-9]*; rm -f [6-9][0-9]*)
fi
# Delete the overview file.
if ${DODELETEOVER} ; then
FILEDIR="${OVERVIEWDIR}/${DOTTOSLASH}"
(cd ${FILEDIR}; rm ${OVERVIEW})
fi
# (try to) Delete the directory, if it is empty. Also possibly
# clean up the parent directories.
if ${DORMDIR} ; then
FILEDIR="${SPOOL}/${DOTTOSLASH}"
while rmdir ${FILEDIR} 2> /dev/null ; do
FILEDIR="`dirname ${FILEDIR}`"
done
fi
shift
done
# Unlock newsgroups.
if ${DONEWSGROUPS} ; then
rm -f ${NLOCK} ${NTEMP}
fi
# Unlock active.times.
if ${DOACTIVETIMES} ; then
rm -f ${ALOCK} ${ATEMP}
fi
# And away we go!
ctlinnd -s go "${INNMODE}"
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