Mini Project :- Linux Shell Scripting for Server Resource Utilization Status and run this in every 5 minutes using Crontab.

Mini Project :- Linux Shell Scripting for Server Resource Utilization Status and run this in every 5 minutes using Crontab.

The script will show the below output on the Screen.

1) welcome the user with his name

2) Show the date & time

3) Uptime of the server and the last logins

4) Show disk space utilization and RAM utilization

5) Show the top 2 processes utilizing the high CPU.

output of dh-H

Below command is used to get the available/total size.

Below command is used to get the RAM utilization in available/total format.

Below command is used to get the top 3 high CPU-utilizing processes.

Script Input:-


Script Output:-

Write a crontab entry in crontab file to run the script every minute of 5 Hr as per ubuntu machine time

Crotab entry added via nano-

\5 \ * * * bash /home/ubuntu/myscripts/Serverchecks.sh >> /home/ubuntu/checkdisklogs.txt

Every minute logs of 5 Hrs are getting appended in a single file under /home/ubuntu/checkdisklogs.txt

check the size of file it was 6138 Mar 29 05:11 & after a minute file size got increased as logs got appended at Mar 29 05:12 and size increased to 7161

Thanks for taking the time to read my blog on Hashnode, hope you find it useful.