Sponsored Content
Top Forums Shell Programming and Scripting Keep a certain number of background processes running Post 302280650 by rwuerth on Tuesday 27th of January 2009 10:37:43 AM
Old 01-27-2009
Also, you should probably set the counter by looking at how many MYSQL processes you have running, and not just counting how many have started. This way you automatically have the current number of processes needed.

So you could use (depending upon shell):

Code:
counter=`ps -f | grep -c $MYSQLDUMP`

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running two processes in background

hi there, here's what i need in my korn-shell: ... begin korn-shell script ... nohup process_A.ksh ; nohup process_B.ksh & ... "other stuff" ... end lorn-shell script in plain english i want process A and process B to run in the background so that the script can continue doing... (6 Replies)
Discussion started by: jacob_gs
6 Replies

2. Shell Programming and Scripting

Determine Number of Processes Running

I am pretty new to unix, and I have a project to do. Part of the project asks me to determine the number of processes running and assign it to a variable. I know how to every part of the project but determine the number of processes running. How can I get just the number of processes... (4 Replies)
Discussion started by: wayne1411
4 Replies

3. Solaris

About running processes in background

Hi, I need to establish a procedure that will start an application in background each time my remote Solaris server is (re)started. This would be a kind of daemon. I am no sysadmin expert, so I am looking for pointers. How should I proceed? What are the main steps? Thanks, JVerstry (9 Replies)
Discussion started by: JVerstry
9 Replies

4. Shell Programming and Scripting

Waiting for an arbitrary background process (limiting number of jobs running)

Hi, I'm trying to write a script to decompress a directory full of files. The decompression commands can run in the background, so that many can run at once. But I want to limit the number running at any one time, so that I don't overload the machine. Something like this: n=0 for i in *.gz... (15 Replies)
Discussion started by: p.f.moore
15 Replies

5. Shell Programming and Scripting

Background Processes

Ok guys so I have my first dummy shell almost done except for one tiny part: I do not know how to run a process in the background, from the code! I already know how to do that in a normal shell: $ program & However, no clue when it comes to how to program that thing. :eek: A very... (2 Replies)
Discussion started by: Across
2 Replies

6. Shell Programming and Scripting

How to Control Number of Processes Running

Hi Is there a way to count how many processes a script has started, count how many of these have finished, and make the script wait if their difference goes over a given threshold? I am using a script to repeatedly execute a code (~100x) which converts 2 data files into one .plt which is in... (4 Replies)
Discussion started by: drbones
4 Replies

7. UNIX for Dummies Questions & Answers

Query on Running Multiple processes in background

HI All , Pardon me for asking some very basic questions, I would be grateful if someone can help. I am trying to execute a shell script which runs multiple processes in background. It includes various operations like copying , DB operations etc etc. Now problem is that the complete script... (6 Replies)
Discussion started by: gpta_varun
6 Replies

8. UNIX for Dummies Questions & Answers

How do you print the number of processes that each user is currently running in Unix?

Ok, so I know there's a way to do this, but I've been trying to find out all afternoon with no luck. I think it should print out something like this: 1 bin 2 daemon 6 duo Where the numbers on the left are the number of processes being run by the user whose name is listed on the right. Is... (4 Replies)
Discussion started by: Duo11
4 Replies

9. Shell Programming and Scripting

Need help on background processes

Hi, I have a schell script parent.ksh from which I am calling three background processes a.ksh,b.ksh and c.ksh. Once these three processes completes the next step in parent.ksh should execute. How to achieve this? Please help me.... Thanks... (1 Reply)
Discussion started by: ravinunna
1 Replies

10. UNIX for Dummies Questions & Answers

How do I find the number of processes running on root?

Is there a certain man command I'm missing here? I searched in ps but I couldn't find something that would give me the number of processes running on root. I only want to see the number of processes, not the processes itself. (2 Replies)
Discussion started by: l3monz
2 Replies
sip_enable_counters(3SIP)			   Session Initiation Protocol Library Functions			 sip_enable_counters(3SIP)

NAME
sip_enable_counters, sip_disable_counters, sip_get_counter_value - counter operations SYNOPSIS
cc [ flag... ] file... -lsip [ library... ] #include <sip.h> int sip_enable_counters(int counter_group); int sip_disable_counters(int counter_group); int sip_get_counter_value(int group, int counter, void *counterval, size_t counterlen); DESCRIPTION
The sip_enable_counters() function enables the measurement and counting of the selected counter group. The only allowed value for the counter_group is SIP_TRAFFIC_COUNTERS, which is defined in <sip.h>. Once enabled, the SIP stack starts measuring end-to-end SIP traffic. The SIP stack keeps track of: o the number of SIP requests sent and received (broken down by methods), o the number of SIP responses sent and received (broken down by response codes), and o the number of bytes sent and received. The following counters are defined in <sip.h> for the SIP_TRAFFIC_COUNTERS group. These counter values are retrieved using the sip_get_counter_value() function. SIP_TOTAL_BYTES_RCVD SIP_TOTAL_BYTES_SENT SIP_TOTAL_REQ_RCVD SIP_TOTAL_REQ_SENT SIP_TOTAL_RESP_RCVD SIP_TOTAL_RESP_SENT SIP_ACK_REQ_RCVD SIP_ACK_REQ_SENT SIP_BYE_REQ_RCVD SIP_BYE_REQ_SENT SIP_CANCEL_REQ_RCVD SIP_CANCEL_REQ_SENT SIP_INFO_REQ_RCVD SIP_INFO_REQ_SENT SIP_INVITE_REQ_RCVD SIP_INVITE_REQ_SENT SIP_NOTIFY_REQ_RCVD SIP_NOTIFY_REQ_SENT SIP_OPTIONS_REQ_RCVD SIP_OPTIONS_REQ_SENT SIP_PRACK_REQ_RCVD SIP_PRACK_REQ_SENT SIP_REFER_REQ_RCVD SIP_REFER_REQ_SENT SIP_REGISTER_REQ_RCVD SIP_REGISTER_REQ_SENT SIP_SUBSCRIBE_REQ_RCVD SIP_SUBSCRIBE_REQ_SENT SIP_UPDATE_REQ_RCVD SIP_UPDATE_REQ_SENT SIP_1XX_RESP_RCVD SIP_1XX_RESP_SENT SIP_2XX_RESP_RCVD SIP_2XX_RESP_SENT SIP_3XX_RESP_RCVD SIP_3XX_RESP_SENT SIP_4XX_RESP_RCVD SIP_4XX_RESP_SENT SIP_5XX_RESP_RCVD SIP_5XX_RESP_SENT SIP_6XX_RESP_RCVD SIP_6xx_RESP_SENT SIP_COUNTER_START_TIME /* records time when counting was enabled */ SIP_COUNTER_STOP_TIME /* records time when counting was disabled */ All of the above counters are defined to be uint64_t, except for SIP_COUNTER_START_TIME and SIP_COUNTER_STOP_TIME, which are defined to be time_t. The sip_disable_counters() function disables measurement and counting for the specified counter_group. When disabled, the counter values are not reset and are retained until the measurement is enabled again. Calling sip_enable_counters() again would reset all counter values to zero and counting would start afresh. The sip_get_counter_value() function retrieves the value of the specified counter within the specified counter group. The value is copied to the user provided buffer, counterval, of length counterlen. For example, after the following call, invite_rcvd would have the correct value. uint64_t invite_rcvd; sip_get_counter_value(SIP_TRAFFIC_COUNTERS, SIP_INVITE_REQ_RCVD, &invite_rcvd, sizeof (uint64_t)); RETURN VALUES
Upon successful completion, sip_enable_counters() and sip_disable_counters() return 0. They will return EINVAL if an incorrect group is specified. Upon successful completion, sip_get_counter_value() returns 0. It returns EINVAL if an incorrect counter name or counter size is speci- fied, or if counterval is NULL. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 11 Jan 2008 sip_enable_counters(3SIP)
All times are GMT -4. The time now is 06:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy