This page is no more maintained, the current one is at http://www.tiian.org/flom/FLoM_by_examples/Use_Case_16.html
Sometimes you need to run a command after another command ended even if the second one has not yet started; example: task A produces a deliverable needed by task B, task B must be executed after task A but task B is fired independently from task A. This type of issues can be solved using a job scheduler and flom does not try to emulate them, but it can help you if you can't use a batch scheduler.
tiian@ubuntu:~$ flom --resource-create=no -- ping -c 3 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.048 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.068 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.067 ms
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.048/0.061/0.068/0.009 ms
tiian@ubuntu:~$ flom -- ping -c 5 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.055 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.121 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.059 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.083 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.072 ms
--- localhost ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4001ms
rtt min/avg/max/mdev = 0.055/0.078/0.121/0.023 ms
command "ping -c 3 localhost" wants to lock the default resource, but it can not create it and waits someone else will create it; command "ping -c 5 localhost" locks the default resource because it can create it (default behavior); the first command can then enqueues itself on default resource because it exists after the second command created it.
What happens if the command are started in the reverse order? Try it:
The result depends from timing, there are basically three cases:
In case 1 and 2 the first command creates the resource and the second command uses it after first command released the lock;
in case 3 the resource created by the first command disappears (automatically cleaned by flom daemon) and the second command waits indefinitely. Take a look to [Use Case 17] for an advanced use case.
This use case allows you to synchronize commands/scripts avoiding a command is executed before another one.
The don't create resource behavior can be obtained using "-e n", "--resource-create=no" command option or "Resource/Create" 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.
Wiki: Configuration
Wiki: FLoM by examples
Wiki: Use Case 17