Page options

General Admin Scripts


Author - xyzmarcus
Here is a general admin type scrip I once did for a project
Have a look at the menu to see what it does
#!/bin/bash

 

clear
cd /media/sdb1/

 

END=100
n=1
while [ END=0 ]; 
do 

echo
echo
echo Your Operating System is :
uname -s 
echo
echo Your Username is :
whoami
echo
echo Your Operating System and Kernel Version is :
uname -o -r
echo

 

 

echo 1.Show top CPU usage
echo 2.Show top MEMORY usage
echo 3.Show avaliable space
echo 4.Save Disk Information
echo 5.Ping whole subnet
echo 6.Save Network Settings

 

 

 

 

 

read opt 
case $opt in

 

(1) ps aux | sort -nrk +4 | head; ps aux | sort -nrk +4 | head>Memorylog; sleep 5 ;;
(2) ps aux | sort -nrk +3 | head; ps aux | sort -nrk +3 | head>ProccessLog; sleep 5 ;;
(3) df -h|grep sda1 |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sda2 |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sda3 |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sda4 |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sda5 |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sdb1 |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sdb |awk '{print "drive"$1" is "$5" used"}'
df -h|grep sdc |awk '{print "drive"$1" is "$5" used"}' ; sleep 5 ;;
(4) df -h ; sleep 5 ; df -h>HDLogs ;;
(5) for IP in 192.168.1.{1..254}; do if ping $IP -c 1 > /dev/null; then echo $IP alive; else echo $IP dead; fi; done; sleep 5 ;;
(6) ifconfig ; sleep 5 ; ifconfig>NETSet ;;

 

 

esac
done

    Post a comment

    Your Name or E-mail ID (mandatory)

     

    No Attachments Found. Click here to upload new file.




     RSS of this page

    Author: Guest   Version: 1.6   Last Edited By: Guest   Modified: 12 May 2010



    Sign in