LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 15
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.
 
  


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:31 PM.

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