[comp.unix.wizards] Unattended dumps

nispa@hutcs.hut.fi (Tapani Lindgren) (12/04/87)

I have encountered a problem trying to make a shell script that would
make incremental backups at nighttime without operator attendance.
The problem results from dump(8) program requiring occasional
responses from the operator through /dev/tty.  The script is
run from another script, /usr/adm/daily, under cron control and has no
controlling terminal, so it just hangs trying to read /dev/tty.  It would
be ok if dump just aborted when facing a situation that would require
operator intervention. The script should never hang in a loop under
any circumstances, because /usr/adm/daily must do other things too
and finish after a reasonable time.

Currently I have the dump script run a background subshell that sleeps for
an hour and then kills the dump script (if it still runs) and all dump
processes.  This is very complicated, however, and the watchdog process
is almost 50% of the whole script.  It is also very slow - I would
like it to stop immediately if it finds an error, report it to log file,
rewind the tape, and let /usr/adm/daily continue its work.

Has anyone out there in the Netland have any suggestions of what to do?
Can yes(1) somehow be piped to a program that reads /dev/tty?
Could dump(8) be modified to abort at errors without any questions?
What kind of unattended backup systems do you have?

---
Tapani Lindgren, Helsinki Univ. of Technology, CS dept.
INTERNET:	nispa@hutcs.hut.fi
UUCP:		mcvax!santra!hutcs!nispa
BITNET:		nispa%hutcs.UUCP@fingate.BITNET

tom@cogpsi.UUCP (Tom Vijlbrief) (12/08/87)

In article <9032@santra.UUCP> nispa@hutcs.hut.fi (Tapani Lindgren) writes:
>Can yes(1) somehow be piped to a program that reads /dev/tty?
>Could dump(8) be modified to abort at errors without any questions?

If you want dump to read the output from e.g. yes(1)
then you'll have to use a pty(4).

You should arrange that this pty is the control terminal of the
dump program and then write (redirect) the output of yes(1) to the pty.

Setting the control terminal of dump is done by writing a program which:

A) Removes the association with its control terminal by:

   ioctl(f, TIOCNOTTY, 0);

B) Opens the pty.

C) Exec's the dump program.

The above applies to Berkeley Unix 4.X