SIGTERM action (was Re: [R] Corrupt .RData)

Kjetil Kjernsmo kjetil.kjernsmo at
Mon Dec 10 19:02:28 CET 2001

Peter Dalgaard BSA writes:
> R 1.4.0 will also have a safe-save feature (first write the workspace
> to a temporary file, then destructively move it over the original.)
> However, if anyone is looking for a project to do in their copious
> free time, a .Rdata debug/fix utility would be very welcome...

Hehe, I'm not volunteering, but since I lost some data to a power
loss (actually, it was just a fuse that blew, power was restored 20
seconds after) and subsequently researching UPSes, I did some thinking
about what R should do when sent a TERM signal. 

A TERM signal will typically be sent by init to all processes when the
battery on the UPS is low. In most cases, the KILL signal will be sent
a few seconds later (though I would personally prefer to write the
takedown script to allow the process more time to respond to TERM in
case it had to save large data sets).

I guess TERM shouldn't write .RData like SIGUSRn does, since the user
may have saved something else in .RData, and didn't want to have it
overwritten. But it might write to e.g. core.RData or something. Then,
the workspace should be written first, in case it gets a KILL signal
shortly after, but I would also like some feature that saves the
objects that only exists within the scope of the function that is
evaluated (I've been running R function for a couple of weeks, keeping
everything in RAM. Not fun to loose all that. Yes, I'm terribly
lazy... :-) ).

Well, those are just loose thoughts... :-) 


Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj at                                - Piet Hein
Homepage <URL:>
Webmaster at                            OpenPGP KeyID: 6A6A0BBC
r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at

More information about the R-help mailing list