dumpsave for 386
Greg Hackney
hack at bellboy.UUCP
Mon Jun 13 09:06:04 AEST 1988
On my 386, if there is a power failure, I wanted the system
to bring itself back up automatically. But it hangs in
/etc/dumpsave waiting for the operator to enter a command.
So, I wrote this program which causes a timeout if
no one is there to answer the question.
To install it, move /etc/dumpsave to /etc/dumpsave1. Then
compile this program and install it as /etc/dumpsave.
I started to write the whole thing in C as a total
replacement program for dumpsave, but decided it
wasn't worth the effort.
--
Greg
------<cut here>------
/* dumpsave.c - Allows auto reboot to proceed on dumpsave question
*
* For Microport 386 Unix systems
* Greg Hackney (hack at bellboy.UUCP) June, 1988
*
* Move the original /etc/dumpsave to /etc/dumpsave1
* Compile this as /etc/dumpsave
*
*/
#include <stdio.h>
#include <signal.h>
#define FILE "/etc/dumpsave1" /* File to be executed */
#define TIME 20 /* Seconds of grace before timeout */
main()
{
int timeout();
char answer[10];
signal(SIGALRM,timeout);
alarm(TIME); /* set the alarm clock */
printf("This following query will time out in %d seconds\n",TIME);
printf("Do you want to save a core image? (y/n): ");
gets(answer);
alarm(0); /* turn alarm off */
if(answer[0] == 'y' || answer[0] == 'Y')
execlp(FILE,FILE,0); /* run the program */
else
exit(0); /* exit w/o running the program */
}
timeout() /* It timed out waiting for an answer */
{
printf("\n");
exit(0); /* exit w/o running the program */
}
More information about the Comp.unix.microport
mailing list