Script for CPU usage -Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script for CPU usage -Linux
# 1  
Old 09-19-2013
Script for CPU usage -Linux

Hi all
I was wondering if its possible to write a script to keep CPU usage at 90%-95%? for a single cpu linux server?

I have a perl script I run on servers with multple cpu's and all I do is max all but one cpu to get into the 90'% utilised area. I now need a script that raises the CPU to 90-95% for 15mins on a server with a single cpu.

---------- Post updated at 09:53 AM ---------- Previous update was at 09:52 AM ----------

Sorry, I should add it needs to be at that level for 10-15mins

Last edited by sudobash; 09-19-2013 at 12:35 PM..
# 2  
Old 09-19-2013
Quote:
Originally Posted by sudobash
I have a perl script I run on on server with multple cpu's and all I do is max all but one cpu to get into the 90'% utilised area.
Run one instance for each CPU.

You could also try something like mprime
# 3  
Old 09-19-2013
[QUOTE=Corona688;302855225]Run one instance for each CPU.



I've updated my original post to provide further clarity
# 4  
Old 09-19-2013
download the stress utility

Use this as a reference.

Linux Stress Test - memory, disk, and cpu testing with StressLinux
# 5  
Old 09-20-2013
well thanks for your advice all but I ended up using
Code:
perl -e 'while (--$ARGV[0] and fork) {}; while () {}' $NUMBER_OF_CPU &

but i re-niced the process until cpu was at 90-95%

Last edited by Franklin52; 09-20-2013 at 09:41 AM.. Reason: Please use code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CPU usage script

Hello Friends, I am trying to create a shell script which will check the CPU utilization. I use command top to check the %CPU usage. It give s me below output Cpu states: CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS 0 0.31 9.6% 0.0% 6.1% 84.3% 0.0% 0.0%... (3 Replies)
Discussion started by: Nakul_sh
3 Replies

2. Shell Programming and Scripting

Shell script to calculate the max cpu usage from the main script

Hi All, I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide which cpu number (column 2) has maximum value (column 6). Since the output is displayed/updated every seconds, it's very... (1 Reply)
Discussion started by: Optimus81
1 Replies

3. Shell Programming and Scripting

Shell script for logging cpu and memory usage of a Linux process

I am looking for a way to log and graphically display cpu and RAM usage of linux processes over time. Since I couldn't find a simple tool to so (I tried zabbix and munin but installation failed) I started writing a shell script to do so The script file parses the output of top command through... (2 Replies)
Discussion started by: andy_dufresne
2 Replies

4. HP-UX

Perl script limit cpu usage

Hi Experts, I am executing multiple instances(in parallel) of perl script on HP-UX box. OS is allocating substantial amount of CPU to these perl processes,resulting higher cpu utilization. Glance always shows perl processes are occupying majority of the CPU resource. It is causing slower... (2 Replies)
Discussion started by: sai_2507
2 Replies

5. Shell Programming and Scripting

Please help me to monitor cpu usage vmstat in Redhat Linux .

Hi , Please some one help me How to write a shell script to monitor cpu usage vmstat in Redhat linux . Thanks, (4 Replies)
Discussion started by: saanvi
4 Replies

6. Shell Programming and Scripting

Identify CPU usage on the Linux server

We are using linux server. We have below script running on the crontab and it send the alert if the cpu usage is above 90%. My question is, the below script tells the CPU usage for one CPU or all CPU in the server? sar 1 1 | sed '$!d' | awk '{printf("%d", $8)}' > $SAR_LOG Please let me... (4 Replies)
Discussion started by: govindts
4 Replies

7. UNIX for Dummies Questions & Answers

100% CPU usage linux commands

hi guys the application guy told me that his server was executing linux commands with some delay...let's say 1-2-3 seconds.... checking the system we found that when the delay took place CPU usage for that command in top was 100%.... this happens for bash, chkconfig, w, df, du among others in... (2 Replies)
Discussion started by: karlochacon
2 Replies

8. UNIX for Advanced & Expert Users

Script to access multiple linux servers to get system details such as CPU usage

Hi Is there any shell script that accesses multiple linux servers to get details such as CPU usage, RAM used etc. The access of the servers must be parallel not serial in the sense it must ping all the servers at a time to get information.The script has to be triggered from a host system and get... (7 Replies)
Discussion started by: mssrivatsa
7 Replies

9. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

10. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies
Login or Register to Ask a Question