a.) a very simple library to build your own shell from
b.) a simple host for a scheduled command (scheduled via OS facilities)
For the latter options you might want to kick of tasks that are pretty unpredictable in time consumption. However, you still want to run them frequently but you don't want to overlap them either. Your OS scheduler facility might have an option to prevent multiple identical tasks from running in parallel. However, that's fine if you only use shell.me to host one task. But if you host severel independent task you actually do want to allow multiple instances of shell.me to run, what you don't want to happen is that multiple instances of shell.me run the exact same command at the same time.
So here is the proposal:
1. Add a boolean AllowParallel Property to the ICommand interface (should be true by default)
2. In case it is false:
Before shell.me kicks of the command it should check:
A. if there is already a file .lock_commandname_* (if so, abort)
B. if not, create .lock_commandname_GUID
C. check if .lock_foo_GUID exists and if no other .lock_foo_* file exists
if there is another .lock_foo_* file, that means that another instance created one at the simultanously and we abort and remove our lock file
shell.me aims to be a perfect fit to be
a.) a very simple library to build your own shell from b.) a simple host for a scheduled command (scheduled via OS facilities)
For the latter options you might want to kick of tasks that are pretty unpredictable in time consumption. However, you still want to run them frequently but you don't want to overlap them either. Your OS scheduler facility might have an option to prevent multiple identical tasks from running in parallel. However, that's fine if you only use shell.me to host one task. But if you host severel independent task you actually do want to allow multiple instances of shell.me to run, what you don't want to happen is that multiple instances of shell.me run the exact same command at the same time.
So here is the proposal:
if there is another
.lock_foo_*
file, that means that another instance created one at the simultanously and we abort and remove our lock file