Note: this use case is available since flom version 0.1.3
Sometimes you need to run a command exclusively as shown in [Use Case 1], but you don't want to wait (enqueue) indefinitely if the lock is currently keep by a different command.
tiian@mojan:~$ flom --resource-timeout=1000 -- ls Resource already locked, the lock was not obtained because timeout (1000 millise conds) expired tiian@mojan:~$ echo $? 98 tiian@mojan:~$
tiian@mojan:~$ flom -- sleep 10 tiian@mojan:~$
command "sleep 10" locks the default resource, command "ls" tries to lock the same resource, but it can wait only 1000 milliseconds ("--resource-timeout=1000" command option) and returns after 1 second.
Using "echo $?" inside the first terminal you can discover the special exit status flom uses to inform you the lock can not be obtained (useful for scripting).
Execute the command "flom --resource-timeout=1000 -- ls" inside the terminal, without locking the resource from the second terminal (you must not execute "flom -- sleep 10" in the second terminal!).
You see the execution of "ls" command: the resource is free and the lock is immediately acquired by this session.
tiian@mojan:/usr$ flom --resource-timeout=1000 -- ls bin games include lib lib64 local sbin share src tiian@mojan:/usr$
This use case allows you to synchronize commands/scripts avoiding time unlimited enqueing: your command will be executed "lock protected" if the resource becomes available before the timeout expires or you will catch a special exit status if the resource is busy and the command can not be performed.
The blocking with timeout behavior can be obtained using "-o NumberOfMilliseconds", "--resource-tiemout=NumberOfMilliseconds" command option or "Resource/Timeout" property inside configuration files.
Flom available arguments are documented in man page: use man flom.
Flom [Configuration] explains how you can specify flom behavior without using command line arguments.