Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-05-2005, 11:47 PM   #1
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
number of running instances

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?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are multiple instances of mysqld running? philpq Linux - Newbie 2 02-17-2005 03:01 PM
How do you determine the number of NFS instances to start? BrianK Linux - Networking 6 10-26-2004 05:23 AM
why there is a need for minor number and major number for monitor/keyboard in pc? tripathi Solaris / OpenSolaris 1 11-07-2003 09:36 AM
9 httpd instances running!?? jlinden Linux - Newbie 2 09-17-2003 11:32 AM
how to change number of running processes rsc Linux - Newbie 2 03-14-2002 05:23 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration