Shell script to monitor process with high CPU


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to monitor process with high CPU
# 1  
Old 04-08-2013
Shell script to monitor process with high CPU

Hi,

Linux redhat 5.5

I need to write a kshell script that shows all the process that consume 100% CPU (or more. strange but there are time that top shows higger value that 100) and they are active more than 5 minute.

The top command shows all the relevat information:
The PID of the cpu , the process name and the ATIME

Please advise

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Process lose its parent then consume high CPU usage ...

Hello. In an informix context, on AIX 5.3 TL 12, we encounter this problem : Sometimes in the day (probably when users exits from their session), a child process lose its parent (PPID is now "1") and this child is consumming lot of CPU "USER". I tried, on different cases, "truss -p... (4 Replies)
Discussion started by: stephnane
4 Replies

2. Shell Programming and Scripting

Monitor the CPU load for each process and total

Hi guys, I have to set up a script which monitors the amount of AVG CPU load per each process and also the total load for a sum of processes. The processes have the same name, I can only differentiate by port number they listen to, as follows : 28171 root 20 0 1089m 21m 3608 S 103... (1 Reply)
Discussion started by: liviusbr
1 Replies

3. Shell Programming and Scripting

Restart debian server if one specific process has more than 10 seconds have high cpu load

Hi, could someone give me an example for a debian server script? I need to check a process if the process has a high cpu load (top). If yes the whole server needs to reboot. Thats it, nothing more. ;) Hope someone could help me. Regards woisch (2 Replies)
Discussion started by: woisch
2 Replies

4. UNIX for Advanced & Expert Users

Shell script to monitor cpu and VMstat, iostat

Hi , I am new to scripting. please help me out how to write a script to monitor cpu , vmstat, iostat in Redhat linux. we are doing the load test. Thanks in advance !!!! (1 Reply)
Discussion started by: saanvi
1 Replies

5. Shell Programming and Scripting

Need help on shell script to monitor each user cpu use on a cluster over time

Hi, I am relatively new to the cluster administration and shell scripting. I need help on a shell script which can help me determine how many cpu's over time, any particular ( or all registered users on a cluster ) are using. To generate data say over a period of week and list of users and their... (6 Replies)
Discussion started by: anuj06
6 Replies

6. Shell Programming and Scripting

Looking for shell script to monitor CPU utilization and send mail once exceed 75%

Dear Group, I'm look for shell script to Monitor CPU usage and send mail once it exceed 75% I'm running Suse10.4. (3 Replies)
Discussion started by: clfever
3 Replies

7. Shell Programming and Scripting

Cron job and shell script to kill a process if memory gets to high

Hello, I'd like to set a cron job that runs a shell script every 30 minutes or so to restart a java based service if the memory gets above 80%. Any advice on how to do this? Thanks in advance! - Ryan (19 Replies)
Discussion started by: prometheon123
19 Replies

8. Shell Programming and Scripting

script to check high cpu utilization for java process

Hello Team, I need help in preparing script to check for high cpu utilisation for java process. I have many java process on my system which consumes high cpu so i have to monitor it using script. ---------- Post updated 12-10-10 at 02:21 AM ---------- Previous update was 12-09-10 at... (1 Reply)
Discussion started by: coolguyamy
1 Replies

9. AIX

High CPU utilization by a pro*C process

Hi , we upgarded our AIX from 5.3 to 6.1 and upgraded our xlc compiler from ver 6.0 to 9.0 . After this upgrade one of our pro*C program is utilizing around 20% of the CPU. Before upgarde its using only 0.2 %. when i try to debug using the truss command i got the below error. $... (6 Replies)
Discussion started by: mugunthanvh
6 Replies

10. Programming

how to monitor the child process on which cpu core

Hi all. Sorry to express my questions wrongly in my early post,I repost my question again here. My pc has dual core, I wirte an application with two process, parents process and child process. My quetion is how to realize :if the child process is on core 0,it will tell me I'm on core 0,if it... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
Login or Register to Ask a Question
SHLOCK(1)						    InterNetNews Documentation							 SHLOCK(1)

NAME
shlock - Create lock files for use in shell scripts SYNOPSIS
shlock [-b|-c|-u] -f name -p pid DESCRIPTION
shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the process ID from the file and test to see whether the process is currently running. If the process exists, then the file will not be created. shlock exits with a zero status if it could create the lock file, or non-zero if the file refers to a currently active process. OPTIONS
-b Process IDs are normally read and written in ASCII. If the -b flag is used, then they will be written as a binary int. -c If the -c flag is used, then shlock will not create a lock file, but will instead use the file to see if the lock is held by another program. If the lock is valid, the program will exit with a non-zero status; if the lock is not valid (i.e. invoking shlock without the flag would have succeeded), then the program will exit with a zero status. -f name name is the name of the lock file shlock attempts to create. If the file already exists, it will read the process ID from the file and exit with a non-zero status if this process is currently active. -p pid pid is the process ID to write into the file name. -u For compatibility with other systems, the -u flag is accepted as a synonym for -b since binary locks are used by many UUCP packages. EXAMPLES
The following example shows how shlock would be used within a shell script: LOCK=<pathrun in inn.conf>/LOCK.send trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15 if shlock -p $$ -f ${LOCK} ; then # Do appropriate work. else echo "Locked by `cat ${LOCK}`" fi HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews after a description of HDB UUCP locking given by Peter Honeyman, and improved by Berend Reitsma to solve a race condition. Converted to POD by Julien Elie. $Id: shlock.pod 8357 2009-02-27 17:56:00Z iulius $ INN 2.5.2 2009-05-21 SHLOCK(1)