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

Re: Daemons

On Tuesday 04 May 2010 04:40:13 export@hope.cz wrote:
> I have several running daemons  that write some data to files
> What happens with these open files when INIT 6 command  is issued?

Depends on the daemon.  Prior to a clean reboot, a process is sent the TERM 
signal, which it may handle however it likes.  Sometime later it is sent the 
KILL signal, which cannot be caught normally, and terminates the process.

> Are these files that are used by daemons deleted? Or are they closed
>  regularly and saved ?

When the kernel terminates the process, they are closed, but not normally.  
There's no C-language close() call or even a kernel-level "close" syscall.

Any data in buffers above the file system layer are lost.

>  And what happens, if the  Linux box is shut down in
>  a dirty way( out of electricity)? Thanks

In this case, no software can really do anything, although things do happen 
for a few milliseconds.  Any data in a buffer that doesn't have a battery is 
lost.  Writes to disk that are in process my even get incorrect data.

Depending on the file system(s) in use, recovery from this state should result 
in something like the kernel terminating every process with a KILL signal at 
some point *prior* to the power loss.
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply to: