bash - How do I use the linux flock command to prevent another root process from deleting a file? -


I would like to stop one of my root processes by deleting a certain file. So I came in the order of the herd, it seems to my needs, but I could not find its syntax.

If I only point out a stock lock, then it does not work:
flock -s "./file.xml"

If I add a timeout parameter, it still does not work
flock -s -w5 "./file.xml"

It seems That fits in, herd [-sxun] [- w #] fd # route.
(What is the FD # parameter?)

Therefore, I flag [-sxon] [- w #] file [-c] command < / Code>
tried to use flock -s -w5 "./file.xml" -c "tail-3 / .file.xml" and this Work done, tail command was executed on ./file.xml.
But I would like to know, the lock ends after the command or after the execution of the command executes it 5 seconds? My main question is, how can I stop any other root process from removing files in Linux?

The flock does not prevent anyone from doing anything Unix Lock Advice, which means they Prevent processes from calling the herd (or in the case of shared lock, preventing any other process by using a special process).

This does not stop the route, or anyone else by reading, writing or removing the file.

In any case, even though it is a mandatory pond, this file will not be stopped from deletion, because this file is not locked, the directory entry.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -