[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Programming hints.



> Beeing busy to write a programm I would like to add a routine
> that forces it to shut down orderly (closing files etc.) when
> recieving a SIGTERM from the system, because the program itself
> is doing work that will keep it going for months at least.
> Can somone tell me of already existing programs where i can study 
> the source to learn about that subject?

man 2 signal

Usage: 

siganl(SIGTERM,shutdown_handler);

where "shutdown_handler" is 

void shutdown_handler(int sig){
  /* do cleanup */
 exit(0);
}

Alex Y.

-- 
   _ 
 _( )_
(     (o___           +-------------------------------------------+
 |      _ 7           |            Alexander Yukhimets            |
  \    (")            |       http://pages.nyu.edu/~aqy6633/      |
  /     \ \           +-------------------------------------------+


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: