Shell script to add new local groups

Bill.Hoffman at Bill.Hoffman at
Thu Nov 18 15:59:25 UTC 1999

      I put a script together to add new groups to my local news group.  I put
this together before I found the ctlinnd stuff in the FAQ (6.3).  I basically
want to show my script to you gurus to find out if this why I am getting errors
when posting.

Here is the errors that I get when posting:

Nov 18 09:33:06 itsup innd: SERVER cant dbzstore No such file or directory
Nov 18 09:33:06 itsup innd: SERVER cant write history
<811644$b0l$1 at> No such file or directory
Nov 18 09:33:06 itsup innd: localhost:15 closed seconds 0 accepted 0 refused 0
rejected 1
Nov 18 09:33:06 itsup rnews: offered <811644$b0l$1 at> 38341bc4
Nov 18 09:33:06 itsup rnews: cant unspool saving to

The post went through but I am concerned about the message going to

Here is the script that I threw together:

USAGE="usage: newsadd"

function getuser {
tput clear
print "Please enter the new newsgroup to be added: \c"
read USER

# Test to see if group already exists
if (( `grep -c "^$USER " ~news/db/active` == 1 ))
  then print "Group already exists"
       print "Hit <enter> to try again <c> to continue or <q> to quit: \c"
       read ENTER

       case $ENTER in
       q) exit 0;;
       c) print "Are you sure you want to create a new group for $USER (y or n)?
         read ANSWER
       if [[ $ANSWER != y ]]
          then exit 0
          #else SKIP=y
       fi ;;
       *) getuser;;
  else realname

# Enter decription of the group for newsgroup file
function realname {
print "Please enter a description of the group: \c"
read REAL

if [[ $REAL == "" ]]
  then print "You must enter a value for Description "
       print "Hit enter to start over..."
       read ANS


# make sure that everything worked alright
function testsuccess {
  if [[ $? == 0 ]]
    then print "Completed successfully"
    else print "Process failed."
         exit 1



# Meat of the program is here
    print "Adding new group"
    print "$USER 0000000000 0000000001 y" >> $ACTIVE
    print "$USER $REAL" >> $NEWSGROUPS
    cd ~news/db
    ~news/bin/makehistory -i
    print "Moving file history.n.index to history.index"
    mv history.n.index history.index
    print "Moving file history.n.hash to history.hash"
    mv history.n.hash history.hash
    print "Moving file history.n.dir to history.dir"
    mv history.n.dir history.dir
    ps aux|grep news|grep -v grep|grep -v newsadd|grep -v $$|kill -9 `awk
'{print $2}'`
    rm ~news/run/*.pid
    su news -c /usr/local/news/bin/

exit 0

Thanx for your time,


More information about the inn-workers mailing list