• Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk
  • Login
  • Register
Upgrade
CloudiBee
  • Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk
No Result
View All Result
  • Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk
No Result
View All Result
CloudiBee
No Result
View All Result
Home Linux

Linux : CPU hammer script

cloudibee by cloudibee
November 12, 2008
in Linux
0
0
SHARES
37
VIEWS
Share on FacebookShare on Twitter
A Simple script to load & hammer the CPU using awk. The script does mathematical calculations and thus CPU load peaks up on higher values passwd to loadserver.sh . (Tested only on Linux)

The script loadserver.sh :

[root@foo313 ~]# cat loadserver.sh
#!/bin/sh

Table of Contents

  • You might also like
  • Linux Change Password Command: Change password expiry in Linux
  • Top Open Source Email Servers

You might also like

Linux Change Password Command: Change password expiry in Linux

April 7, 2021
Email Servers

Top Open Source Email Servers

September 7, 2021

# unixfoo.blogspot.com

if [ $1 ]; then
        NUM_PROC=$1
else
        NUM_PROC=10
fi

for i in `seq 0 $((NUM_PROC-1))`; do
        awk ‘BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}’ &
done

echo “PIDS: `pidof awk`”

[root@foo313 ~]#

Before script execution :

[root@foo313 ~]# uptime
 09:22:18  up 14 days,  2:07,  3 users,  load average: 0.00, 0.02, 0.04
[root@foo313 ~]#

Script execution :

[root@foo313 ~]# ./loadserver.sh 10
PIDS: 11429 11428 11427 11426 11425 11424 11423 11422 11421 11420
[root@foo313 ~]# ps -ef | grep awk
root     11420     1 31 09:22 pts/1    00:00:01 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11421     1 45 09:22 pts/1    00:00:02 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11422     1 32 09:22 pts/1    00:00:01 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11423     1 29 09:22 pts/1    00:00:01 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11424     1 48 09:22 pts/1    00:00:02 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11425     1 45 09:22 pts/1    00:00:02 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11426     1 27 09:22 pts/1    00:00:01 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11427     1 46 09:22 pts/1    00:00:02 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11428     1 28 09:22 pts/1    00:00:01 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11429     1 34 09:22 pts/1    00:00:01 awk BEGIN {for(i=0;i<10000;i++)for(j=0;j<10000;j++);}
root     11450 11351  0 09:22 pts/1    00:00:00 grep awk

Check out the load :

[root@foo313 ~]# uptime
 09:22:44  up 14 days,  2:07,  3 users,  load average: 4.07, 0.93, 0.34
[root@foo313 ~]#

[root@foo313 ~]# mpstat 1
Linux 2.6.21 (foo313)        11/12/2008

09:24:56 AM  CPU   %user   %nice %system %iowait    %irq   %soft   %idle    intr/s
09:24:57 AM  all   99.00    0.00    0.75    0.00    0.00    0.25    0.00    678.79
09:24:58 AM  all   99.75    0.00    0.00    0.00    0.00    0.25    0.00    149.00
09:24:59 AM  all  100.00    0.00    0.00    0.00    0.00    0.00    0.00    113.00
09:25:00 AM  all   99.50    0.00    0.50    0.00    0.00    0.00    0.00    186.00

[root@foo313 ~]#

Previous Post

AIX syslog

Next Post

Netapp Snapshot: quick guide

cloudibee

cloudibee

Related Posts

Linux

Linux Change Password Command: Change password expiry in Linux

by cloudibee
April 7, 2021
Email Servers
Linux

Top Open Source Email Servers

by cloudibee
September 7, 2021
Linux

How to Determine Redhat Versions Command

by cloudibee
May 27, 2022
Linux

How-to Linux List Processes in 3 Simple Commands

by cloudibee
May 27, 2022
Linux

What is Cron Job in Linux?

by cloudibee
May 27, 2022
Next Post

Netapp Snapshot: quick guide

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Premium Content

Self-Service Data Management in a Hybrid IT World

May 27, 2022

How to identify whether the machine supports para virtual guests?

November 2, 2007

Netapp Snapmirror Setup Guide

October 24, 2009

Browse by Category

  • Business
  • Cloud
  • Code
  • Debt
  • Entertainment
  • finance
  • Game
  • Health
  • IT
  • Lawyers
  • Lifestyle
  • Linux
  • Marketing
  • Misc
  • News
  • SEO
  • Services
  • Splunk
  • Sports
  • Tech
  • Technology
  • Tipes
  • Tips
  • Uncategorized

Browse by Tags

algorithm Apache Apache2 AWS Bash bash history Bind Blacklists Buffer C C++ CentOS Cerner chage Cloud Cloud Computing Cloud jobs Cloud Storage Cloud Suite Commands Compliance Cron job Debian Directory DMS DNS Docker Dovecot drop cache Email servers Enteprise Cloud Enterprise External FAT32 Format kernel Linux linux kernel Nirvanix passwd Sendmail SSH SSL Terminal Ubuntu

About CloudiBee

cloudibee logo


CloudiBee is an open-source for people who love technology. Here we will be sharing lots of technical information over the web so that a lot of people visit us and gain some knowledge. We are a completely open to all platform. We assure you that you can easily get any info and updated news about the tech world from us. Let's begin with us!

Hot Topic

What are the best internet options for lawyers?

by samanvya
August 15, 2022
0
What are the best internet options for lawyers?

Meeting clients, questioning possible witnesses and getting in contact with other people in the case, or preparing for hearings with...

Read more

Recent News

Lifestyle

Best Gifts To Offer A Friend Who Owned A New House

July 22, 2022
Business

The main reasons for the startup fails. How to avoid failure?

July 21, 2022
Business

Hacks for packing wine glasses so they don’t break

July 21, 2022

CloudiBee. © 2021. All Rights Reserved

No Result
View All Result
  • Contact Us
  • Home
  • About Us
  • News
    • Entertainment
    • Trending
  • IT
    • Code
    • Cloud
    • Linux
    • Splunk

CloudiBee. © 2021. All Rights Reserved

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In