catching SIGTERM

Serge Aleynikov <>
Fri Jul 15 21:12:44 CEST 2005

I can think of two ways of doing this:

1. Write a port driver in C (or another language) that would handle 
SIGTERM events and dispatch them to the linked Erlang process using 
message passing.  (If interested I can provide you with such code, 
though I believe the second approach is easier).

2. Call some function that dumps state from another node.  Here is an 
example of calling server:dump_state() on the 'nodename' node from 
another node:

   echo "rpc:call('nodename@`hostname -s`', server, dump_state, [])." | \
       erl -sname restarter -hidden


Charles Blair wrote:
> i'd like to be able to trap a SIGTERM from an application written in
> erlang+yaws so i can dump some state to disk when that happens. is
> there a way to do this? searching the net brought up two similar
> questions with no responses. thanks.

More information about the erlang-questions mailing list