[news.sysadmin] Cheap news to mail interface

edw@wells.UUCP (Ed Wells) (02/19/89)

---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
#	Run the following text with /bin/sh to create:
#	  README
#	  mail.news
#
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
X
X  Here's a little program that I wrote to send mail to users that don't
Xhave news running.  This allows me to write a few small shell scripts
Xto feed this one, like:
X---------------------------------------------------------------------------
Xmail.news john sci.electronics rec.humor
X
Xmail systema!john </ram/news.john
Xmail systemb!dave </ram/news.dave
X
Xrm /ram/news.john
X
X
Xmail.news school comp.sys.att comp.sources.unix comp.sources.d comp.sources
X
Xmail schoola!harry schoola!sam schoolb!charle </ram/news.school
X
Xrm /ram/news.school
X---------------------------------------------------------------------------
X  If you add anything to this, please send me your updates and a brief
Xdescription as to what it does.
X
X  Ed Wells (edw@wells)
X
X--
X=========================================================================
XEdward E. Wells Jr., President			    Voice: (215)-943-6061
XWells Computer Systems Corp., Box 343, Levittown, Pa. 19058
X{dsinc,francis,hotps,lgnp1,mdi386,pebco}!wells!edw
X
SHAR_EOF
chmod 0640 README || echo "restore of README fails"
set `wc -c README`;Sum=$1
if test "$Sum" != "988"
then echo original size 988, current size $Sum;fi
echo "x - extracting mail.news (Text)"
sed 's/^X//' << 'SHAR_EOF' > mail.news &&
X#
X# Program name = "mail.news"
X# @(#)mail.news	1.1
X# Written by:	Ed Wells, President, Wells Computer Systems Corp.
X#		Wells Computer Systems Corp., Box 343, Levittown, Pa. 19058
X#		(215)-943-6061, Voice
X#		(215)-943-0435, (Data Telebit 19200-1200)
X#		Usenet:	wells!edw / edw@wells
X#		UNIX System V 3.1  /  SCO Xenix V
X#
X# Original date .....	Sun Feb 19 02:56:29 EST 1989
X# Last update	 .....	Sun Feb 19 02:56:29 EST 1989 (before SCCS)
X# SCCS delta date ...  2/19/89 -- 03:12:20
X# SCCS extracted  ...  2/19/89 -- 03:14:46
X#
X# Program description	: Used to for occasionally extracting mail from
X#			  your news directory(s) and creating a scratch
X#			  file for various users for those who are not
X#			  setup for news.
X#
X#			  For instance, I expire several groups every 2 days,
X#			  therefore, I run this script to create files to be
X#			  mailed.  Then I send those users the processed file
X#			  and delete the scratch file.
X#
X# Future plans		: Adding a mechanism like news to remember the last
X#			  message read per group.
X#
X# Considerations	: If you add anything to this, please mail me your
X#			  changes back.
X#
Xsccsid="@(#)mail.news	1.1 2/19/89"
X
Xecho "
XProgram   : $sccsid
X
XWritten by: Edward E. Wells Jr.
X            Wells Computer Systems Corp.
X            Box 343, Levittown, Penna. 19058
X" >&2
X
Xcmd=`basename $0`
XNEWSPATH=/usr/spool/news
Xexport cmd NEWSPATH i slashname dotname
X
Xif [ $# -lt 2 ]
X	then	echo "\007Usage: $cmd username newsgroup(s)" ; exit 1
Xfi
X
Xcd $NEWSPATH
XOUTFILE=/ram/news.$1 ; >$OUTFILE ; shift
X
Xwhile [ "$1" ]
X  do
X    slashname=`echo $1 | sed -e 's/\./\//g'`
X    if [ ! -d $NEWSPATH/$slashname ]
X	then echo "\t\"$NEWSPATH/$slashname\" is an invalid directory." >&2
X	shift
X	continue
X    fi
X
X    for i in $slashname/*
X      do
X	if [ ! -f $i ]
X	    then continue
X	fi
X	dotname=`echo $i | sed -e 's/\//./g'`
X	echo "Processing \"$dotname\"." >&2
X	echo "
X
X	---  $dotname  ---
X"
X	cat $NEWSPATH/$i | grep -v "^Path: "
X      done | pr -h "Newsgroup = \"$1"\" >>$OUTFILE 2>/dev/null
X
X    if [ $? -ne 0 ]
X	then echo "No files for \"$1\"." >&2
X    fi
X    shift
X  done
X
Xecho "All output is in \"$OUTFILE\"." >&2
SHAR_EOF
chmod 0550 mail.news || echo "restore of mail.news fails"
set `wc -c mail.news`;Sum=$1
if test "$Sum" != "2132"
then echo original size 2132, current size $Sum;fi
exit 0
-- 
=========================================================================
Edward E. Wells Jr., President			    Voice: (215)-943-6061
Wells Computer Systems Corp., Box 343, Levittown, Pa. 19058
{dsinc,francis,hotps,lgnp1,mdi386,pebco}!wells!edw