From: export on
I have several running daemons that write some data to files
What happens with these open files when INIT 6 command is issued?
Are these files that are used by daemons deleted? Or are they closed regularly and saved ?
And what happens, if the Linux box is shut down in a dirty way( out of electricity)?
Thanks
L.


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4BE0079D.4796.6039ABB(a)export.hope.cz
From: Anand Sivaram on
normally as a part during reboot/shutdown procedure, sigterm is sent
to all processes. This causes processes to terminate during which file
descriptors are closed down flushing their cache. This is written to disk
during filesytem sync.
So these files are preserved. But when the system goes down because of a
power glitch, there are chances that you lose your data from last filesystem
sync.


On Tue, May 4, 2010 at 15:10, <export(a)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?
> Are these files that are used by daemons deleted? Or are they closed
> regularly and saved ?
> And what happens, if the Linux box is shut down in a dirty way( out of
> electricity)?
> Thanks
> L.
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster(a)lists.debian.org
> Archive: http://lists.debian.org/4BE0079D.4796.6039ABB(a)export.hope.cz
>
>
From: Ron Johnson on

Since SIGTERM is catchable, your code should nicely clean itself up.

On 05/04/2010 06:06 AM, Anand Sivaram wrote:
> normally as a part during reboot/shutdown procedure, sigterm is sent
> to all processes. This causes processes to terminate during which file
> descriptors are closed down flushing their cache. This is written to disk
> during filesytem sync.
> So these files are preserved. But when the system goes down because of a
> power glitch, there are chances that you lose your data from last filesystem
> sync.
>
>
> On Tue, May 4, 2010 at 15:10,<export(a)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?
>> Are these files that are used by daemons deleted? Or are they closed
>> regularly and saved ?
>> And what happens, if the Linux box is shut down in a dirty way( out of
>> electricity)?
>> Thanks
>> L.

--
Dissent is patriotic, remember?


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4BE03B6D.2010008(a)cox.net
From: Boyd Stephen Smith Jr. on
On Tuesday 04 May 2010 04:40:13 export(a)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(a)iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/