home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!ieunet!!bsullivn
- From: bsullivn@sc.sni.ie (Bryan O'Sullivan)
- Newsgroups: comp.unix.programmer
- Subject: Re: How to restart a process after the machine is up.
- Message-ID: <164@sc.sni.ie>
- Date: 18 Aug 92 09:46:33 GMT
- Article-I.D.: sc.164
- References: <SULLIVAN.92Aug17154930@liz.cs.rose-hulman.edu>
- Reply-To: bryan@sc.sni.ie
- Organization: Siemens-Nixdorf Software Development Centre, Dublin
- Lines: 26
- X-Newsreader: Tin 1.1 PL3
-
-
-
- sullivan@cs.rose-hulman.edu (Fred Sullivan) writes:
-
- : A trick which may or may not be applicable. If the current state of the
- : process is easily saved (say by writing to a file) you can write a signal
- : handler for an unused signal (e.g. SIGUSR1), which dumps the state.
-
- : When the program starts up, have it read its starting state from the file.
-
- : When you want to shut down the machine, just send the process a signal. I
- : once used this technique to keep a program running for several months.
-
- Possibly a better approach: when a UNIX system is being brought down to
- single-user mode to be powered down, the script that handles this (on
- SVR4 at least) sends a SIGTERM to all user processes and gives them
- around 5 seconds of grace to save state or clean thingss up before
- sending them a non-maskable SIGKILL. You might do better to write a
- SIGTERM handler for your application; it avoids the need for
- special-casing.
-
- -- Bryan
-
- --
- Bryan O'Sullivan +353-1-767551 x225
- Siemens-Nixdorf Informationssysteme AG bryan@sc.sni.ie
- Software Development Centre "Theory like mist on eyeglasses.
- Dublin Obscure facts." -- Charlie Chan
-