hoytech / vmtouch

Portable file system cache diagnostics and control

Home Page:https://hoytech.com/vmtouch/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to process one lock after each other?

mgutt opened this issue · comments

commented

The following command does not make sense, as the first execution leaves vmtouch open:

vmtouch -l /file1
vmtouch -l /file2
vmtouch -l /file3

So instead I need to use the daemon mode:

vmtouch -d -l /file1
vmtouch -d -l /file2
vmtouch -d -l /file3

But by that all daemons are executed parallel (which can overload the CPU). Is it possible to wait until one lock command has been finished, before starting the next one?

The following solution works, but adds much more sleep time as it would be necessary:

vmtouch -d -l /file1
sleep 60
vmtouch -d -l /file2
sleep 60
vmtouch -d -l /file3

In this particular example could you not do:

vmtouch -l /file1 /file2 /file3

This will mlock() each file in sequence.

Oh and by the way, you can background a process with "&" in your shell to avoid daemonizing. Daemonizing will actually put the daemon process into a separate session, which is often not what is desired:

vmtouch -l /file* &