1#! /bin/sh 2 3# This script handles the inbound newsgroup update requests 4 5cd /var/mailserv/newsgup 6 7LOGFILE=log 8INMAIL=/tmp/mfin.$$ 9OUTMAIL=/tmp/mfout.$$ 10STDERR=/tmp/ef.$$ 11LOCALADMIN=news 12MAILCMD=/usr/bin/mail 13active=/var/db/news/active 14newsgroups=/var/db/news/newsgroups 15 16cleanup () 17{ 18 rm -f $INMAIL $OUTMAIL $STDERR 19} 20 21trap cleanup 0 1 15 22 23# Save the mail 24 25cat >$INMAIL 26 27# Run the group update program 28 29REMOTEADMIN=`bin/gup -a $active -n $newsgroups -l log -m $OUTMAIL \ 30 <$INMAIL 2>$STDERR` 31ok=$? 32 33# did the process complete correctly? 34 35( 36 37if [ $ok = 0 ]; then 38echo "Your automated newsgroup update has been processed." 39else 40echo "Your automated newsgroup update has **FAILED**." 41fi 42 43echo 44cat $OUTMAIL 45if [ -s $STDERR ]; then 46 echo "==============STDERR begin=====================" 47 cat $STDERR 48 echo "==============STDERR end=======================" 49 echo 50fi 51echo 52echo "@@@@@@@@@@@@@@@@@@@@The original mail@@@@@@@@@@@@@@@@@@@@" 53echo 54cat $INMAIL 55) | $MAILCMD -s "Result of automated newsgroup update" -c $LOCALADMIN $REMOTEADMIN 56