Gnu – Flock

This is an interesting command. Have you ever wanted to be sure that just one instance of your app/script is running at the same time? Then, flock is your tool. The sintax is as follows:

flock [options] file|directory command [arguments]

Lets see an example:

flock /home/user/lockfile htop

This runs htop and uses a generated file in home/user named lockfile to control the locking. If you try to run the same command, you will not be able to run htop again until the first instance finish.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *