number of running instances
hello,
Is there a way to limit the number of instances of a running script to 'n', where n is read from a configuration file.
I have a shell script which is called by many other process. But i want to limit the number of the running scripts to 'n'. I have no way of curbing at the source, because the source may be from other machines also.
The first stmt inside the script is to count the number of instances using "pidof -x". If it is greater than 'n', i am qutting. But the problem here is that, the child process of the shell script in question also gets the same name as the parent, so counting via "pidof" gives me wrong result.
Can anybody suggest a solution or give a pointer?
TIA.
|