Linux / UNIX Tech Support Forum
This is a discussion on CPU usage Shell script (Monitoring CPU Usage) within the Shell scripting forums, part of the Development/Scripting category; I am looking for a shell script which will create a file if a perticular process CPU usage increases after ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I am looking for a shell script which will create a file if a perticular process CPU usage increases after a certain limit. |
| Sponsored Links | ||
|
|
|
||||
|
Here is the script if 15 minutes load goes >= 6.0.
Code:
#!/bin/bash
# Set up limit below
NOTIFY="6.0"
FTEXT='load average:'
# 15 min
F15M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f3)"
# compare it with last 15 min load average
RESULT=$(echo "$F15M > $NOTIFY" | bc)
# if load >= 6.0 create a file /tmp/file.txt
if [ "$RESULT" == "1" ]; then
echo 'LOAD ISSUE'>/tmp/file.txt
fi
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| cpu load , linux , monitoring , shell script , unix |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unix command to check memory usage | sweta | HP-UX | 3 | 24-02-2010 10:54 PM |
| unix find out ram usage command | charvi | Solaris/OpenSolaris | 4 | 10-04-2008 02:22 AM |
| Limiting RAMFS usage | sathiya | Getting started tutorials | 1 | 28-03-2008 09:11 AM |
| application usage | zafar466 | Web servers | 1 | 31-03-2007 12:01 AM |
| Postgres vacuumdb usage | kasimani | Databases servers | 2 | 06-03-2007 07:30 AM |