Shell script to control user initiated processes

Posted by Gnanam on Server Fault See other posts from Server Fault or by Gnanam
Published on 2010-03-27T06:02:19Z Indexed on 2010/03/27 6:03 UTC
Read the original article Hit count: 328

Filed under:
|

Hi,

I'm not a shell script expert. I'm looking for a shell script which checks for maximum number of Java processes (MyJavaStandalone) running in the system before starting/executing the current Java process.

Example:

Script: /home/myfolder/script.sh

script.sh contains

/usr/java/jdk1.6.0/bin/java MyJavaStandalone >> $DATE.log &

Here, before executing "MyJavaStandalone", if there are already 10 processes running, then this current process should not be started.

© Server Fault or respective owner

Related posts about linux

Related posts about bash-scripting