notes@bcstec.UUCP (Notes admin.) (10/17/89)
This script will be of use if you do not Autocreate your notes files. When autocreation is turned off the nfmaint notefile lists all of the groups that it could not access. What this script will do is get a list of those groups and add them to your invalid file, so you will not get more fail notes and notes won't keep adding new failed notes messages. It will also create groups that you define from the notes that failed. I use this with version 2.8.2. I can't vouch that it will work with any other. Jim sadler uunet!bcstec!jsadler or jsadler@bcstec.boeing.com 206-234-9009 #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Notes admin. (J. Sadler) <notes@bcstec> on Mon Oct 16 15:56:11 1989 # # This archive contains: # inval # # Existing files will not be overwritten. # Error checking via wc(1) will be performed. # Error checking via sum(1) will be performed. unset LANG if sum -r </dev/null >/dev/null 2>&1 then sumopt='-r' else sumopt='' fi if test -f inval then echo Ok to overwrite existing file inval\? read answer case "$answer" in [yY]*) echo Proceeding;; *) echo Aborting; exit 1;; esac rm -f inval if test -f inval then echo Error: could not remove inval, aborting exit 1 fi fi echo x - inval cat >inval <<'@EOF' # This script will be of use if you do not Autocreate your notes files. # When autocreation is turned off the nfmaint notefile lists all of the # groups that it could not access. What this script will do is get a list # of those groups and add them to your invalid file, so you will not get # more fail notes and notes won't keep adding new failed notes messages. # It will also create groups that you define from the notes that failed. # # Example: inval # No arguments simply adds the failed newsgroups to the invalid file. # # Example: inval rec. comp.sys.zenith. talk.jabber comp.sys.mac # The arguments listed above would allow any of the failed rec.*, # comp.sys.zenith.* talk.jabber* comp.sys.next* groups to be created. # # This script should be put in the crontab for notes and run once a day. # Example: # 39 3 * * * inval comp. news. rec. talk. # # or # 39 3 * * * inval `cat valid` # # valid would contain a list of groups, one group per line, you want # created. NOTESHOME=/usr/contrib/lib/notes/ PATH=/bin:/usr/bin:/usr/local/bin:/usr/contrib/bin:$NOTESHOME TMPORG=/tmp/invalid.org TMP=/tmp/invalid$$ # # put copy of current invalid file into the tmp directory and backup # the orginal invalid to ~notes/invalid.last. echo "Starting inval script "`date` >>$NOTESHOME/net.log # # Get a list of the failed notes with nfprint from nfmaint. Look for the # failed ones (grep) and get the name of the group (cut). Remove the trail- # ing comma (tr) and take tr's output sort it and remove duplicate lines (sort). # Save the output in $TMP # nfprint nfmaint |grep "Newsinput failed:"|cut -d" " -f4|tr -d ","|sort -u > $TMP if [ ! -s $TMP ] # Is anything in the TMP file ? then echo "No failed Groups. Done at "`date` >>$NOTESHOME/net.log /bin/rm $TMP # Nope. cleanup and leave. exit fi cp $NOTESHOME/invalid $TMPORG cp $NOTESHOME/invalid $NOTESHOME/invalid.last echo "Made invalid.last. " >>$NOTESHOME/net.log # # Look for arguments. # if [ $# -gt 0 ] then # Ok we have arguments while [ $1 ] do echo $1 >> /tmp/sed$$ # Put the arguments into /tmp/sed$$ shift # Get the next arg. done # # Change the lines in sed$$ to be RE's. Ex: comp.sys.mac # will be changed to ^comp\.sys\.mac # Do this to all lines in sed$$ and put in grep$$. sed -e 's/^/\^/' -e 's/\./\\\./g' /tmp/sed$$ > /tmp/grep$$ /bin/rm /tmp/sed$$ # Done with sed$$. # # grep thru the TMP file useing the RE's in grep$$. # Take what grep finds and feed it to mknf. # Any created notesfiles will be mailed to the notes # account. mknf -onq `egrep -f/tmp/grep$$ $TMP` # # Remove the created notesfiles from TMP and append the # remainder in TMPORG. egrep -f/tmp/grep$$ -v $TMP >> $TMPORG /bin/rm /tmp/grep$$ # Done with grep$$ # cat $TMPORG >>$NOTESHOME/net.log else # echo "No arguments. " >>$NOTESHOME/net.log cat $TMP >> $TMPORG # If there were no arg then append # TMP to TMPORG. fi sort -u $TMPORG > $NOTESHOME/invalid # Sort TMPORG to it make pretty and # remove duplicate lines. Replace # the orginal invalid file. # # echo "created new invalid. " >>$NOTESHOME/net.log rm $TMPORG $TMP # Done with TMPORG and TMP. # echo "deleting nfmaint notes. " >>$NOTESHOME/net.log # Clean up the nfmaint notefile. nfarchive -d -0 nfmaint >> $NOTESHOME/net.log 2>&1 echo "Done at "`date` >>$NOTESHOME/net.log exit @EOF set `sum $sumopt <inval`; if test $1 -ne 10325 then echo ERROR: inval checksum is $1 should be 10325 fi set `wc -lwc <inval` if test $1$2$3 != 1015733394 then echo ERROR: wc results of inval are $* should be 101 573 3394 fi chmod 755 inval exit 0