[comp.unix.questions] uupoll for system 5

news@csd_v.UUCP (NEWS NET) (12/14/87)

Some time ago I inquired about methods for polling remote systems
in non-HONEY DANBER uucp.  I also wanted to know how one could
tell what the outcome of a forked uucico process was.

Basically I got two suggestions, one was to queue a null file for
the sight to be polled.  This would accomplish the basic polling
task and seems to be used by many people.  The second was in response
to the uucico status.  It was suggested that after uucico completes
the parent process open a pipe to uustat and read the outcome.  I'm 
sorry that I've lost the name of the respondant who suggested this.

Since the only time the message "CONVERSATION SUCCEEDED" is output
by:
	$ uustat -m sysname

is if all phases of a transfer were successful, this seemed like a
good idea and I have written a C program based on it.  The source
has been posted to comp.sources.misc and the README file is 
included below.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Uupoll is a polling mechanism for sysV unix systems which
are running non-HONEYDANBER uucp.  This version of uucp
lacks such a mechanism.  No attempt has been made to 
duplicate the functionality of either HONEYDANBER or
BSD polling mechanisms since the author does not have
even the slightest idea of what those mechanisms might
be.

The version of uupoll included here has the following
features:

1.  $ uupoll sysname

creates a file in the spool directory named P.sysname.  No check is made to
see if sysname is included in L.sys.  The poll file at present consists of
a single record

D nn

where nn is the expiration number described in the -d option below.
The following options are valid in this form of the command.  

	-p path 	Specifies the path of an alternate spool directory.  The
				default directory is /usr/spool/uucp.
	-d n		Specifies the number of invocations of "uupoll -c"
				required to expire the poll.  The default is 3 in the
				absence of this switch.

2.  $ uupoll -[r|l] sysname

removes or lists to standard output the poll files associated with
the named systems.  The special system name "all" is valid with
this form of the command.

3.  $ uupoll -c

decrements the value n in the poll file and when n reaches 0, deletes
the poll file.  Sends mail to the owner stating that the poll has
expired before a successful connection was established.  This command 
is intended to be run daily.

4.  $ uupoll

invokes uucico as a child process  for each poll file in the spool directory.
At the completion of the conversation (if any) uustat is invoked to see
if the conversation succeeded.  If so, the poll file is removed from the
spool directory.  The following switches are valid

	-p path		Specifies the path of an alternate spool directory.
	-x          Causes -x9 debugging output from uucico.

If for any reason the conversation was not successful the poll file
is left intact and the poll is retried at the next invocation of the
uupoll command.

EXAMPLE:

The following is an example of the intended usage of the command.
The polling of systems aaa and bbb by user joe at 4 a.m. daily and
of system ccc by fred at 8 and 11 p.m. is accomplished.

# in joe's crontab (have poll in place before the hour):
55 3 * * * uupoll aaa > /dev/null
55 3 * * * uupoll bbb > /dev/null

# in fred's crontab (have poll in place before the hour):
55 19,22 * * * uupoll bbb > /dev/null

# in uucp's crontab (service all polls hourly):
0 * * * * uupoll > /dev/null

# in root's crontab (expire polls daily):
0 2 * * * uupoll -c > /dev/null

To build uupoll the standard compilation command is sufficient:

	$ cc -O -o uupoll uupoll.c

I would of course appreciate any feedback, suggestions, bug reports, etc.