[net.news.sa] All these newgroup messages !!!

broome@waldo.UUCP (Jonathan C. Broome) (11/25/85)

[burp]

We just got clobbered with 35 newgroup messages from that new site! Argh!
Well, as has bee said before, it *is* possible to create new newsgroups
locally without using inews -C and blasting the rest of the world.  This 
is a shell script that we use around here that I hope may be useful to
someone else out there...  It's a _csh_ script (sorry folks w/o csh),
and may need some tuning for your site, but it should be simple enough.


  --- Jonathan Broome
  ...!dual!waldo!{usenet,broome}


==== cut here ==== cut here ==== cut here ==== cut here ==== cut here ====


#! /bin/csh
#  
#   A quick shell script to add new newsgroups without inews -C
#   It even tries to make any of the needed upper-level directories ... 
#   It assumes that the group is to be postable.
#

set newsuser = news
set newsgrp  = news                 # may be "daemon" at your site
set libdir   = /usr/lib/news        # usually ~${newsuser}
set active   = ${libdir}/active
set spooldir = /usr/spool/news
set mode     = 755                  # Some people have them mode 777 ...
set name     = $0                   # Just the name of this script.

if ($#argv < 1) then
    echo Usage: $name:t group \[ group ... \]
    exit 1
endif

cp $active ${active}.old            # Just in case !!!

foreach group ( $* )
    echo Adding group $group ...

    #  Now to make sure all the directories exist ...
    set dirparts = ( `echo $group | sed 's;\.; ;g'` )
    set dir = $spooldir
    foreach part ( $dirparts )
        set dir = ${dir}/${part}
        if (! -e $dir) then
            echo Making directory $dir
            /bin/mkdir $dir
            chown $newsuser $dir
            chgrp $newsgrp  $dir
            chmod $mode     $dir
        endif
    end

    #  And add to the active file ...

    echo  "$group 00000 00000 y" >> $active
end

echo All done ...
exit 0

hansen@pegasus.UUCP (Tony L. Hansen) (12/09/85)

Since I have but don't use or even want to use csh, I have rewritten the
posted "newgroup" Csh script into a /bin/sh shell script. This shell script
should be a standard part of 2.10.3 netnews along side of the rmgroup.sh.

					Tony Hansen
					ihnp4!pegasus!hansen

#!/bin/sh
# This is a shar archive.
# The rest of this file is a shell script which will extract:
# newgroup.sh
# Archive created: Mon Dec 9 12:14:14 EST 1985
echo x - newnewsgrp.sh
sed 's/^X//' > newgroup.sh << '~FUNKY STUFF~'
#! /bin/sh
#  
#   A quick shell script to add new newsgroups without inews -C
#   It even tries to make any of the needed upper-level directories ... 
#   It assumes that the group is to be postable.
#

newsuser=news
newsgrp=news			# may be "daemon" at your site
libdir=/usr/lib/news		# usually ~${newsuser}
active=${libdir}/active
spooldir=/usr/spool/news
mode=755			# Some people have them mode 777 ...
name=$0				# Just the name of this script.

case $# in
    0 )
        echo "Usage: $0 group [ group ] ..." 1>&2
        exit 1;;
esac

cp $active ${active}.old            # Just in case !!!

for group in $*
do
    echo Adding group $group ...

    #  Now to make sure all the directories exist ...
    dir=$spooldir
    for part in `echo $group | sed 's;\.; ;g'`
    do
        dir=${dir}/${part}
        if [ ! -d $dir ]
	then
            echo Making directory $dir
            /bin/mkdir $dir
            chown $newsuser $dir
            chgrp $newsgrp  $dir
            chmod $mode     $dir
        fi
    done

    #  And add to the active file ...

    echo  "$group 00000 00000 y" >> $active
done

echo All done ...
exit 0
~FUNKY STUFF~
ls -l newnewsgrp.sh
# The following exit is to ensure that extra garbage 
# after the end of the shar file will be ignored.
exit 0