Path: utzoo!attcan!uunet!husc6!psuvax1!rutgers!bellcore!tness7!bellboy!hack From: hack@bellboy.UUCP (Greg Hackney) Newsgroups: comp.unix.microport Subject: dumpsave for 386 Message-ID: <1099@bellboy.UUCP> Date: 12 Jun 88 23:06:04 GMT Organization: Home - Dallas, Texas Lines: 57 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 ------------ /* dumpsave.c - Allows auto reboot to proceed on dumpsave question * * For Microport 386 Unix systems * Greg Hackney (hack@bellboy.UUCP) June, 1988 * * Move the original /etc/dumpsave to /etc/dumpsave1 * Compile this as /etc/dumpsave * */ #include #include #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 */ }