home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume6
/
uupoll
/
Uupoll
Wrap
Text File
|
1989-03-06
|
3KB
|
130 lines
: # Uupoll (1.0)
: #
: # Bourne shell script to force polling of a remote system
: #
: # Written by:
: # Michael M. Levin - Feb, 1988
: #
: # Copyright (c) 1988
: # Michael M. Levin
: #
: # (levin@srhqla.UUCP, levin@magnus.UUCP)
: #
: #
: # This script is intended for Public distribution. It shall
: # not be distributed in any manner whatsoever, nor packaged for
: # enhancement to a commercial product in any form, for profit.
: # This agreement also stipulates that the users of this script
: # will not remove the names of the origional Author nor this
: # copyright notice from this script.
: #
: # Revision: Version 1.0 Feb 1988
: #
: # Developed for System V using HoneyDanBer uucp.
: # (AT&T Basic Networking Utilities)
: #
: # Last Updated: Sat Feb 27 17:35:00 PST 1988
: #
: # Usage:
: #
: # This shell must be run by either super-user or uucp.
: # It causes a poll request to be entered (or touched, if
: # one already exists) for the specified system. Even if
: # the file permissions are changed to allow execution by
: # other users, the shell will abort itself.
: # If the shell is started with only a system name, it simply
: # creates an entry which will be handled the next time that
: # uusched is run. To also cause uusched to start up, start
: # it with a '-n' (NOW) option ahead of the system name.
: # For example:
: #
: # Create entry only: Uupoll sysname
: # Start uusched also: Uupoll -n sysname
PATH=/bin:/usr/bin:/etc:/usr/lib/uucp
export PATH
SYS=/usr/lib/uucp/Systems # Full pathname to Systems file(s)
SPOOL=/usr/spool/uucp # Mail system spool directory
UUCP=uucp # Local uid name for uucp (usually uucp)
MAIL=mail # Local gid name for mail (usually mail)
ROOT=root # Local uid name for root (usually root)
NOW=NO
USAGE="\tusage: ${0} [-n] sysname"
umask 022
set +e
: # Determine that we are either uucp or root:
if id|cut -f2 -d\(|cut -f1 -d\)|grep "^${UUCP}$" > /dev/null
then
continue
elif id|cut -f2 -d\(|cut -f1 -d\)|grep "^${ROOT}$" > /dev/null
then
continue
else
echo "${0}: you must be uucp to run this. FAILED"
exit 2
fi
: # Verify that a system name has been passed to us:
set -- `getopt n $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for i in $*
do
case $i in
-n) NOW=YES; shift;; # Is 'NOW' flag set??
--) shift; break;;
esac
done
if [ $# != 1 ]
then
echo "${0}: you must specify system name. FAILED"
exit 2
fi
: # Make sure system name exists in our local Systems file:
if uuname | grep "^${1}$" > /dev/null
then
site=$1
continue
else
echo "${0}: '"$1"' is not a valid system name. FAILED"
exit 2
fi
: # If a spool directory doesn't exist for this system, create one.
if [ ! -d $SPOOL/$site ]
then
mkdir $SPOOL/$site
chown $UUCP $SPOOL/$site
chgrp $MAIL $SPOOL/$site
fi
: # Create the poll entry in the specified system's spool directory.
j=`expr $site : '\(.\{1,7\}\)'`
touch $SPOOL/$site/C.${j}n0000
chown $UUCP $SPOOL/$site/C.${j}n0000
chgrp $MAIL $SPOOL/$site/C.${j}n0000
: # If NOW option selected, start the scheduler.
if [ $NOW = YES ]
then
touch $SPOOL/.Status/$site
rm $SPOOL/.Status/$site
nohup uusched > /dev/null &
nohup uuxqt > /dev/null &
fi