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.
5 2383
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?
#!/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
Looks like you're doing pretty well on this, did you have a question?
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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.
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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
|
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...
| |