> I haven't looked at the relevant snippets, so I'll just post what mine
> does.  I'm sure it's similar.

Please do so 8=)

> I set the signal to SIG_DFL as soon as it's caught, fork a new process,
> then raise the signal again in the parent.

Looks good to me, but what does DFL meane? cant say i have used that
one befoure?

> The new process goes on to save everything and do a soft boot, the parent
> just dies, leaving a core file.

If you do a fork, does every thing in memory stays the same, but you just 
restart
from main?

> If it crashes while saving, the signal has already set to default, so
> it'll go ahead and crash (unfortunately this often overwrites the
> parent's core file.. anybody know how to alter the filename a core is
> saved to?).

maybe you could just move the old core via a syscall in the sighandler,
but then again it might fu*kup the new core.

> Anyway, the crash_copyover function is basically just a copy of
> do_copyover without the send_to_char's, etc.

ahh, but whynot use send_to_desc?
(remember if you are using Mccp1 or 2, then dont use send_to_desc befour
makeing shure that the client is aware of it chould nolongere compress.

> I also save some debugging information to another file in
> crash_copyover, such as the last command processed, who gave it, etc.
> 
> The number of times it's crashed is sent to the command line (would be
> just as easy to save it to the copyover file though), and once it gets
> big, the mud just exits and shuts up.  This avoids problems where the
> mud crashes before it gets running, but after the signal handler has
> been initialized, and there's a sort of execution loop, and I always
> forget about the killall program and end up chasing pid's for a few
> minutes.
> 
> Haven't had any real problems with it, seems to be a good scheme.
> The only thing I've seen people do that might add to it is saving pfiles
> to a different name before the copyober so either the old one or the new
> one is hopefully right.

Thats what i was planing on adding soon, but i think there is someone
on this list that already have this done, so peter if it was you, share plz 8=).

> void sig_handler(int sig)
> {
>   signal(sig, SIG_DFL);
>   switch(fork())
>   {
>     case 0:
>       crash_copyover();
>     case -1:
>       perror("signal_handler: fork");
>     default:
>       raise(sig);
>   }
> }
> 
> That turned out longer than I thought..
> --Palrich.

Shure looks big, but its a nice tropic 8=)


Reply via email to