473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

i need a shell script

i need to make a script that queries relevant system information from the /proc file system, the uname command, the output of dmesg, and possibly other sources on the system. the script should collect this information in variables, format it, then store it in a text file.
Jun 22 '07 #1
5 2383
sicarie
4,677 Expert Mod 4TB
i need to make a script that queries relevant system information from the /proc file system, the uname command, the output of dmesg, and possibly other sources on the system. the script should collect this information in variables, format it, then store it in a text file.
Ok, so what do you have so far? Have you decided what shell you are using? Are you familiar with the different ways of getting that information?
Jun 22 '07 #2
#!/bin/bash
#
#
#


name=$(uname -s)
version=$(uname -v)
hardware=$(uname -m)
release=$(uname -r)
mem=$(free -omt)
disk=$(df -lh)
hname=$(uname -n)
cpu=$(cat /proc/cpuinfo | grep 'cpu MHz' | sed 's/cpu MHz//')
cpumodel=$(cat /proc/cpuinfo | grep 'model name' | sed 's/model name//')
who=$(whoami)
lwho=$(logname)
uptime=$(uptime |sed 's/,.*$//')
#
#
echo "information about your PC"
echo "OS Type : $name"
echo "Hostname : $hname"
echo "Currently logged in as : $who"
echo "CPU Model $cpumodel"
echo "CPU Speed $cpu MHz"
echo "Kernel Version : $version"
echo "Kernel Release : $release"
echo "System Uptime :$uptime"
echo
echo "Hard Disk"
echo "$disk"
echo
echo "System Memory info"
echo "$mem"
echo
echo "/proc file system info"
procinfo=$(/usr/bin/procinfo)
echo "$procinfo"
echo
dmesg > /tmp/dmesg.out
cat /tmp/dmesg.out
Jun 22 '07 #3
sicarie
4,677 Expert Mod 4TB
Looks like you're doing pretty well on this, did you have a question?
Jun 22 '07 #4
well at first when i read that scenario i was mindblow on where to start. but then looked at a couple sample scripts and went to town... all i need to do now is export all that information into a txt file.
Jun 22 '07 #5
sicarie
4,677 Expert Mod 4TB
well at first when i read that scenario i was mindblow on where to start. but then looked at a couple sample scripts and went to town... all i need to do now is export all that information into a txt file.
Oh cool, ok. Check this out. Looks like you can use the standard redirects in the script just as you would on the command line.
Jun 22 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mohsin | last post by:
Hi all, I have a perl program which makes a user exit to the O/S (unix, solaris) to issue a O/S command. I know that the shell it invokes is NOT a korn shell, because I captured the shell info...
0
by: Vladimir Nesterovsky | last post by:
Hello, I'm having a trouble with a Shell.Folder object when I'm trying to use it from a C++ application, but at the same time, the same object works fine from within html script. The effect...
14
by: mistral | last post by:
Need compile python code, source is in html and starts with parameters: #!/bin/sh - "exec" "python" "-O" "$0" "$@" I have installed ActivePython for windows.
3
by: Mark | last post by:
Hello, What I need to know is if there is a better method to run/edit modules on my pc. I'm currently running the IDLE shell under Python 2.5, on Windows XP. Every time I edit my .txt or .py...
3
by: telduivel | last post by:
Can someone please help me with this: I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I...
2
by: ellennolan | last post by:
Hello, I wonder if anyone can help with calling external shell script in c++. Basically, in the shellscript, I want to pass src, dst, md5. If the src's md5 matches md5 given, it will be link to...
5
by: Hul Tytus | last post by:
comp.lang.c c programs & shell conditionals How is a unix shell script made to respond to the value returned by a program compiled from c code? The shell script below is my current effort,...
5
by: inetquestion | last post by:
I am looking for a web interface for shell commands or shell scripts. Does anyone know of any exexisting php scripts which would solve this requirement? PHP form accepts input from a user, then...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
4
by: devi thapa | last post by:
Hi, I am executing a python script in a shell script. The python script actually returns a value. So, can I get the return value in a shell script? If yes, then help me out. Regards, Devi
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.