tilo@ethz.UUCP (Tilo Levante) (08/29/90)
We have some simulation programms, which run several weeks. Very often these processes have to be killed because we have to reboot the system. Is there a way to save the status of a process and restart it after the shutdown? Thanks Tilo Levante tilo@nmr.lpc.ethz.ch
rad@genco.uucp (Bob Daniel) (08/30/90)
In article <5759@ethz.UUCP> tilo@tilo@nmr.lpc.ethz.ch (Tilo Levante) writes: > >Is there a way to save the status of a process and restart it >after the shutdown? > The following is for SysV 3.2 UNIX: To start processes at startup, you need to make a startup script in the /etc/rc2.d directory. The filename must start with an S and be followed with a number which indicates the order that it will be executed. Look at other files in that directory and you'll get the idea. Refer to 'rc2' in your system manual for more info. BTW, to properly stop system services at shutdown script, you want to write a shutdown script in the /etc/rc0.d directory. The filename must start with a K and be followed by a number. Also, to initiate an autostartup after shutdown, shutdown your system using the -i6 option. # shutdown -y -g0 -i6 Will shutdown your system with zero grace period and reboot.
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/30/90)
In article <5759@ethz.UUCP> tilo@tilo@nmr.lpc.ethz.ch (Tilo Levante) writes: >Is there a way to save the status of a process and restart it >after the shutdown? We just finished a discussion of this; perhaps this is yet another candidate for the FAQ list. The answer is, no, in general if the process was not coded to support some means of interruption and subsequent restart then there isn't any way to do it. However, a few UNIX systems do provide a limited form of checkpoint/restart that works if the process meets certain constraints. Such added checkpointing features are implemented differently among those systems that have them, and you must therefore check your local system documentation for details.
avg@hq.demos.su (Vadim G. Antonov) (09/03/90)
In article <5759@ethz.UUCP> tilo@tilo@nmr.lpc.ethz.ch (Tilo Levante) writes: >Is there a way to save the status of a process and restart it >after the shutdown? Of course, Unix allows you to do such things. You can do it as follows: Write a signal handler for SIGKILL: - scan through file descriptors (with fstat) and detect opened ones and their types (TTY, disk file, directory) and offsets from the beginning; - open a save-file - store open files status information into the file You have to keep names of opened files (use your own version of _open and _create syscalls). - save the stack (from the top of stack, depends on your system/machine) to this file by write syscall - save the data segment (from _etext ptr to _end ptr or from address 0 to _end - if you use a separate mode). Some systems require more detailed investigation of segments layout. - make setjmp C-library routine with the given jmp_buf IF it returns 0 THEN save jmp_buf into the file _exit(0) FI - read file descriptors information from the save-file and perform appropriate setup (open files, seek, etc) - perform a program re-initialization actions (it may be redrawing screen, etc) - return Write a special branch into _main: - if there is no save file, run as usually - otherwise call an assembly routine, which goes the following way: - expands the stack by touching the stack's lower memory cell (or calls a stack-expanding routine on some systems) - reads the stack segment in (using read system call, NOT read C-library routine) - reads the data segment - restores the stack ptr & instruction pointer from the saved jmp_buf Of course, this way is extremely tricky and requires an assembly programming and the brilliant knowledges on internals of the ur system; but it's possible. I've done such a thing seven years ago on Unix v6. Lucky Hacking! Vadim Antonov, DEMOS, Moscow, USSR (It is NOT a joke!)
george@hls0.hls.oz (George Turczynski) (09/14/90)
In article <1990Sep3.105523.8220@hq.demos.su>, avg@hq.demos.su (Vadim G. Antonov) writes: > In article <5759@ethz.UUCP> tilo@tilo@nmr.lpc.ethz.ch (Tilo Levante) writes: > >Is there a way to save the status of a process and restart it > >after the shutdown? > > Of course, Unix allows you to do such things. > You can do it as follows: > > Write a signal handler for SIGKILL: ... Interesting rest of solution deleted ... This solution fails at step number one, as SIGKILL cannot be caught (or ignored). This is fundamental. > Lucky Hacking! This would be one HELL of a hack :-) > (It is NOT a joke!) Was this posted on April 1 ? -- | George P. J. Turczynski. |---------------------------------------------------- | Computer Systems Engineer. | ACSnet: george@highland.oz | I can't speak for the | | Highland Logic Pty. Ltd. | Phone: +61 48 683490 | company, I can barely | | Suite 1, 348-354 Argyle St | Fax: +61 48 683474 | speak for myself... | | Moss Vale. NSW. Australia. 2577 |----------------------------------------------------
cbp@icc.com (Chris Preston) (09/20/90)
In article <933@hls0.hls.oz> george@hls0.hls.oz (George Turczynski) writes: >In article <1990Sep3.105523.8220@hq.demos.su>, avg@hq.demos.su (Vadim G. Antonov) writes: >> In article <5759@ethz.UUCP> tilo@tilo@nmr.lpc.ethz.ch (Tilo Levante) writes: >> >Is there a way to save the status of a process and restart it >> >after the shutdown? >> >> Of course, Unix allows you to do such things. >> You can do it as follows: >> >> Write a signal handler for SIGKILL: > > ... Interesting rest of solution deleted ... > >This solution fails at step number one, as SIGKILL >cannot be caught (or ignored). This is fundamental. Ahhh, but zey haf veys ... > >> Lucky Hacking! > >This would be one HELL of a hack :-) > >> (It is NOT a joke!) > >Was this posted on April 1 ? > One wonders if perhaps the Capatilists have simply been giving in to SIGKILL out of weakness, while the Soviets had no such moral restraint :-) "Puny Amerikans, you let yourselves be used by the evil SIGKILL, while we have crushed it utterly!" cbp --- Disclaimer - This is definitely a joke or not, for any humor intended or otherwise, unless it isn't, intended to be unoffensive, unless of course it is, in which case it should not be and is withdrawn, or not. Kurt Waldheim to Saddam Hussein: "Saddam, I knew Hitler, and believe me, you're no Adolf Hitler."
avg@hq.demos.su (Vadim G. Antonov) (09/21/90)
Stop chatting!!!!!! I was a (large) bit sleepy when I wrote it. Of course I mean SIGTERM. Vadim Antonov DEMOS, Moscow, USSR (It is NOT a joke!)
rprimmer@lemond.rtp.dg.com (Bob Primmer) (09/21/90)
In article <1990Sep20.201903.4642@hq.demos.su>, avg@hq.demos.su (Vadim G. Antonov) writes: > > Stop chatting!!!!!! > > Vadim Antonov > DEMOS, Moscow, USSR Nyet!