"uucp" by tape
Andrew Macpherson
andrew at stc.UUCP
Tue Jul 16 02:56:15 AEST 1985
This shell script was put together the third time
one of my niebours stopped being able to read the uucp
traffic as fast as it was accumulating. There is a built-
in assumption of subdirectories ( simple style rather
than DEC's ) but it should be easily modified to suit
other configurations.
This is offered "as is" with all usual and/or excessive
disclaimers, because I hate to think anyone would re-invent
the wheel.
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# uutape.l
# uutape
# This archive created: Mon Jul 15 15:55:09 1985
export PATH; PATH=/bin:$PATH
echo shar: extracting "'uutape.l'" '(650 characters)'
if test -f 'uutape.l'
then
echo shar: will not over-write existing file "'uutape.l'"
else
sed 's/^ X//' << \SHAR_EOF > 'uutape.l'
X.TH uutape local
X.SH NAME
Xuutape \- make a tar tape of spooled uucp traffic
X.SH SYNOPSIS
X.B uutape
Xsystem [gradeletter]
X.SH DESCRIPTION
X.I uutape
Xwill build a tar tape of spooled uucp data files, suitable for
Xreading in on the remote system relative to spool/uucp
X.PP
XIf
X.I gradeletter
Xis not specified
X.I uutape
Xwill build the tar with all spooled news and mail files, otherwise
Xonly those with the appropriate grade letter are selected.
X.PP
X.I uutape
XAttempts to avoid spooled uucp commands for other than news
Xand mail.
X.SH AUTHOR
XAndrew Macpherson. <andrew at stc.UUCP>
X.SH BUGS
XUntested with uusend commands, ignores mode information in Cmd files.
SHAR_EOF
if test 650 -ne "`wc -c < 'uutape.l'`"
then
echo shar: error transmitting "'uutape.l'" '(should have been 650 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'uutape'" '(1030 characters)'
if test -f 'uutape'
then
echo shar: will not over-write existing file "'uutape'"
else
sed 's/^ X//' << \SHAR_EOF > 'uutape'
X#!/bin/sh
Xif [ $# = 0 -o $# -gt 2 ]
Xthen
X echo Usage: $0 sysname [grade]
X exit 1
Xfi
X
Xuuname | grep -s $1
Xif [ $? -ne 0 ]
Xthen
X echo "Unknown system $1"
X exit 2
Xfi
X
Xif [ $# = 2 ]
Xthen
X grade=${2}
Xelse
X grade=
Xfi
X
Xspool=/usr/spool/uucp
Xhost=`uuname -l`
X
Xif [ -d ${spool}/C.${1} ]
Xthen
X work=${spool}/C.${1}
Xelse
X work=${spool}/C.
Xfi
X
Xcd $work
X
Xmkdir /tmp/D. /tmp/X.
X
Xif [ $? -ne 0 ]
Xthen
X echo "can't create temporary directories"
X exit 2
Xfi
X
Xfor cmdf in `ls | grep "${1}${grade}"`
Xdo
X if [ `grep "^S D" $cmdf | wc -l` = 2 ]
X then
X sed -e "s;S \(D.${host}X*\)\([^ ]*\) \([DX]\.\)\([^ ]*\).*;mv ${spool}/\1/\1\2 /tmp/\3/\3\4 ;" $cmdf >> /tmp/cmd$$
X echo $work/$cmdf >> /tmp/rm$$
X fi
Xdone
X
Xsh /tmp/cmd$$
X
Xcd /tmp
X
Xchmod 666 D./* X./*
X
Xans="n"
Xwhile [ "${ans}" -ne "y" ]
Xdo
X echo -n "Please mount tape then type y"
X read ans
X if [ "${ans}" = "y" ]
X then
X tar co0 D. X.
X if [ $? -ne 0 ]
X then
X ans="n"
X echo "Tape failed - retry"
X mt rew
X fi
X fi
Xdone
X
Xrm -rf /tmp/D. /tmp/X.
Xrm `cat /tmp/rm$$` /tmp/rm$$ /tmp/cmd$$
Xexit 0
SHAR_EOF
if test 1030 -ne "`wc -c < 'uutape'`"
then
echo shar: error transmitting "'uutape'" '(should have been 1030 characters)'
fi
chmod +x 'uutape'
fi # end of overwriting check
# End of shell archive
exit 0
--
Regards,
Andrew Macpherson. <andrew at stc.UUCP>
{creed, datlog, idec, iclbra, root44, stl, ukc}!stc!andrew
More information about the Comp.sources.unix
mailing list