Question about IP set extras

Hi,

While reading the IP set extras' wiki page, I came across the lock command.

I think I get what it does in this case :

lock -n /var/lock/ipset-setup

But not in that one :

lock -u /var/lock/ipset-setup

In the first case, according to the help menu (lock -h), I suppose it just creates a file in the /var/lock dir and stores the current PID into it. But in the second one, I would suppose that it would just remove the specified lock file or something similar. But when I do some command-line testing with this -u parameter, nothing happens. I don't get what it's supposed to do…

Does someone have an explanation, please ?

(since you wrote the document, @vgaetera, maybe ?)

1 Like

Using a lockfile helps avoid concurrent jobs triggered by multiple hotplug events.
Unlocking and preserving the lockfile indicates the hotplug script has finished its job.

Thank you for your answer @vgaetera !

But do you know what exactly happens when unlocking ?

Unlocking closes the open file descriptor terminating the relevant processes if any:

1 Like

Great, that was what I was looking for.

Thank you again !

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.