processes on server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting processes on server
# 1  
Old 02-13-2004
Bug processes on server

Hello All,
I have a need for a script which will look at the number of processes running on the server and decides whether to run its next command or not.

Eg: autosys starts abc.sh after watching for a file abc_start
abc.sh will remove the abc_start file from the server calls a stored procedure using sqlplus.
then it sleeps for 5 minutes
then it needs to evaluate if the max number of processes is reached (lets say it is 5)
if processes count is < 5 then it will touch abc_start and exits.

Any help will be greatly appreciated
Thanks
# 2  
Old 02-13-2004
See if this'll work for you or not:
Code:
rm abc_start
<call procedure>
sleep 300
totproc=`ps -e | wc -l`
if [[ $totproc < 5 ]]; then
  touch abc_start
fi

# 3  
Old 02-15-2004
Thank you for your response. It looks like our requirement is more complex that what I have explained earlier.

What we would like to do is to run only a certain number of our processes at any given time.
currently what we have is:
Our shell scripts will invoke sqlplus run a procedure and after its completion sleep for 5 minutes before creating a file and exiting the program. Once the file is created autosys filewatcher will run the same script.

what we would like to see is: I will try to explain it using an example: # of process limit is 5
EG: Assuming there are 5 processes running now 1,2,3,4,5
process 6 wakes from sleep and would like to run but it has to check how many processes are running (in our case 5) so there is no room for this one at this time. This process should go into a queue and wait for one of the process to complete.
Basically first come first served approach.

Help greatly appreciated!
Thanks
# 4  
Old 01-24-2005
Hi ssikhar,

I have (100% ) similar requirement. Could you let me know if you found any solution for this.

thanks
Chandu
# 5  
Old 01-24-2005
Could someone respond to the above problem. Response would be gr8ly appreciated!

thanks
Chandu
# 6  
Old 01-25-2005
Let each process maintain a file which contains its PID.
So , if we have 5 processes are runing then we do have 5 PID files.

Let each process remove its PID file when it is completed/done.

The script should continually check whether 5 PID files exist. 5 PID files exist mean all 5 processes are running.

The script which is checking these 5 PID files periodically (sleep and wake )
, will start 6th process if one of the PID files is absent.

6th process also writes a PID file while it is starting.

You can repeat the same thing ... based on your requirement what you want to do afterwards.
# 7  
Old 01-25-2005
Quote:
Originally Posted by chanduhyd4u
Could someone respond to the above problem. Response would be gr8ly appreciated!
chanduhyd4u, please read the rules if you haven't yet done so. Bumping posts to try and gain a quicker response is not permitted. And just 5 minutes after posting the first request?! Smilie

Thanks
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Check processes running on remote server

Hello Guys, I need some help to find out if processes are running on remote server or not. I could do 'ssh' to do that but due to some security reasons, I need to avoid the ssh & get result from remote server. Could you please suggest some that can be done without ssh or similar sort of... (8 Replies)
Discussion started by: UnknownGuy
8 Replies

2. AIX

Need to check long running processes on the database server and the os is AIX

Hello, Please help me with a script with which I can check long running processes on the database server and the os is AIX. Best regards, Vishal (5 Replies)
Discussion started by: Vishal_dba
5 Replies

3. Windows & DOS: Issues & Discussions

Controlling AIX processes remotely using a NET app on a Windows server?

I have a .NET application that remotely starts, stops, and gets status of Windows services and scheduled tasks. I would like to add the capability of starting, stopping, and getting status of remote AIX applications also. Based on some preliminary research, one option may be to use 3rd party .NET... (0 Replies)
Discussion started by: auser1
0 Replies

4. Shell Programming and Scripting

killing serious of processes in the server

i am new to unix..i have requirement to kill informatica server process. when i used the below query pidoff "pmserver" it displayed 3 process running.. i need to get the 3 process and kill individual process in shell script. Can you please assit me in this. (2 Replies)
Discussion started by: hkoshekay
2 Replies

5. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

6. Programming

Connecting child processes to the server

I try to fork child processes and they connect to a server. At the beginning, I create a socket(1 socket for all child processes), after that at each child process I connect to the server using connect function but I get this error msg:"Transport endpoint is already connected" but if I create a... (2 Replies)
Discussion started by: xyzt
2 Replies

7. Solaris

Identifying and grouping OS processes and APP processes

Hi Is there an easy way to identify and group currently running processes into OS processes and APP processes. Not all applications are installed as packages. Any free tools or scripts to do this? Many thanks. (2 Replies)
Discussion started by: wilsonee
2 Replies

8. UNIX for Advanced & Expert Users

Monitoring Processes - Killing hung processes

Is there a way to monitor certain processes and if they hang too long to kill them, but certain scripts which are expected to take a long time to let them go? Thank you Richard (4 Replies)
Discussion started by: ukndoit
4 Replies

9. Shell Programming and Scripting

Script to check running processes on remote server.

Hi, I am trying to write a script, which queries a db to get the names of processes, stores it in a file and then checks if that process is running on a remote server. However I am not getting it right, could anyone help me out. #!/bin/sh echo "select Address from Device where Cust =... (5 Replies)
Discussion started by: amitsayshii
5 Replies
Login or Register to Ask a Question