Register
It is currently Sun Oct 26, 2014 3:29 am

a system info script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 10 posts ] 
Author Message
 PostPosted: Wed Jun 15, 2005 1:22 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
A start on a system info script..... nothing real fancy....
I started this on usalug.org, but thought it could be reposted here.


Code:
#!/bin/bash
#
echo "Bash System Information Report" >> systemreport.txt
echo "------------------------------" >> systemreport.txt
echo  " " >> systemreport.txt
echo "*****[CPU INFORMATION]*****" >> systemreport.txt
procinfo >> systemreport.txt
cat /proc/cpuinfo >> systemreport.txt
echo " " >> systemreport.txt
echo "*****[NETWORK INFORMATION]*****" >> systemreport.txt
route >> systemreport.txt
echo " " >> systemreport.txt
echo "*****[DISK USAGE]*****" >> systemreport.txt
df -h >> systemreport.txt
echo " " >> systemreport.txt
echo "*****[MEMORY INFORMATION]*****" >> systemreport.txt
echo " " >> systemreport.txt
cat /proc/meminfo >> systemreport.txt


Top
 Profile WWW  
 PostPosted: Wed Jun 15, 2005 9:36 pm   
Site Admin

Joined: Tue May 17, 2005 7:31 pm
Posts: 251
Location: Georgia
i had to write almost that exact same script in my linux admin class..it was part of the hands on final for the scripting portion of the track :)


Top
 Profile  
 PostPosted: Mon Apr 05, 2010 12:07 am   

Joined: Sat Apr 03, 2010 1:47 pm
Posts: 6
Awesome script.
A suggestion I have is to use a single ">" for your first echo.
If you decide to run this command numerous times (for any reason), it will be an ever-appending file.
Here is what I have set to clear out (any) previous entries:
Code:
echo "Bash System Information Report" > systemreport.txt


For a "cleaner" output, I added the empty echo in between the CPU INFORMATION results:
Code:
procinfo >> systemreport.txt
echo " "  >> systemreport.txt
cat /proc/cpuinfo >> systemreport.txt


Lastly, to see the output once it has completed, I appended this:
Code:
cat systemreport.txt


Top
 Profile  
 PostPosted: Tue Apr 06, 2010 5:26 pm   

Joined: Wed Mar 10, 2010 8:05 pm
Posts: 25
jbsnake wrote:
i had to write almost that exact same script in my linux admin class..it was part of the hands on final for the scripting portion of the track :)



that... was the final for scripting portion of a class? wow. they must not have taught you guys much :-/


Top
 Profile  
 PostPosted: Tue Apr 06, 2010 5:49 pm   

Joined: Wed Mar 10, 2010 8:05 pm
Posts: 25
it could use a few more things, depending on how detailed you want to get.

here's mine
Code:
#!/bin/bash
if [[ $UID != 0 ]]; then echo 'Sorry, must be root.  Exiting...'; exit; fi

echo "*****[CPU INFORMATION]*****" > systeminfo.txt
procinfo >> systeminfo.txt
cat /proc/cpuinfo >> systeminfo.txt
echo " " >> systeminfo.txt
echo "*****[NETWORK INFORMATION]*****" >> systeminfo.txt
ifstat >> systeminfo.txt
route >> systeminfo.txt
echo " " >> systeminfo.txt
echo "*****[DISK & PARTITION]*****" >> systeminfo.txt
fdisk -l >> systeminfo.txt
df -h >> systeminfo.txt
echo " " >> systeminfo.txt
echo "*****[MEMORY INFORMATION]*****" >> systeminfo.txt
cat /proc/meminfo >> systeminfo.txt
echo " " >> systeminfo.txt
echo " ******* [SYSTEM] ****** " >> systeminfo.txt
uname -a >> systeminfo.txt
lsmod >> systeminfo.txt
rc-update show >> systeminfo.txt # show services
echo " " >> systeminfo.txt
echo " ******* [GCC] ***** " >> systeminfo.txt
gcc -v  1>>systeminfo.txt  2>>systeminfo.txt
echo " " >> systeminfo.txt
echo " ******* [PCI] ****** " >> systeminfo.txt
lspci >> systeminfo.txt
echo " " >> systeminfo.txt
echo " ******* [USERS] ****** " >> systeminfo.txt
cat /etc/passwd >> systeminfo.txt
echo " ******* [USER GROUPS] ****** " >> systeminfo.txt
echo "$(for line in `cat /etc/passwd | cut -d: -f1`; do echo $line: $(groups $line) ; done)" >> systeminfo.txt
echo " " >> systeminfo.txt


Top
 Profile  
 PostPosted: Sat Apr 24, 2010 7:16 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
caibbor wrote:
jbsnake wrote:
i had to write almost that exact same script in my linux admin class..it was part of the hands on final for the scripting portion of the track :)



that... was the final for scripting portion of a class? wow. they must not have taught you guys much :-/



ha ha ha obviously you know nothing of jbsnake, so if i were you i would not make any snap judgements..... he does earn his living now, mostly writing shell scripts ;)


Top
 Profile WWW  
 PostPosted: Wed Sep 01, 2010 2:43 pm   
Site Admin

Joined: Tue May 17, 2005 7:31 pm
Posts: 251
Location: Georgia
=))

man... i needed that...


Top
 Profile  
 PostPosted: Wed Sep 01, 2010 2:53 pm   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
* Patsie sends an NTP request to jbsnake.

Is your internal clock off by a couple of months, or have you been on a really long holiday? :)


Top
 Profile  
 PostPosted: Wed Sep 01, 2010 3:17 pm   
Site Admin

Joined: Tue May 17, 2005 7:31 pm
Posts: 251
Location: Georgia
I've been "aff" (away from forum... i love making up my own acronyms) for quite awhile. My job got pretty hectic there for awhile (busy and massive changes). I think it's calmed down a bit now, so I will probably frequent here a bit more again.


Top
 Profile  
 PostPosted: Fri Sep 03, 2010 7:10 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
jbsnake wrote:
I've been "aff" (away from forum... i love making up my own acronyms) for quite awhile. My job got pretty hectic there for awhile (busy and massive changes). I think it's calmed down a bit now, so I will probably frequent here a bit more again.



WHO HOOO ! :)


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP