1834167 Members
2487 Online
110064 Solutions
New Discussion

system check

 
SOLVED
Go to solution
Kenn Chen
Advisor

system check

How could I check my server with all the output save into a file and i only need to check the file instead of checking command by command in Unix. Foe instances, I want to use dmesg,ioscan -fn, bdf commands and all output should save into a file called "syscheck.dat" file.
Cyber Zen
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: system check

Hi:

You could do something like this:

#!/usr/bin/sh
F=/tmp/syscheck.dat
date > $F
dmesg >> $F
ioscan -fn >> $F
bdf >> $F

Note that the '>>' causes output to be appended whereas '>' results in output overwriting a file (or creating a new one if none exists).

...JRF...
Dan Hetzel
Honored Contributor

Re: system check

Hi Chen,

As another option, you could create a script with the following:

#!/usr/bin/sh
exec > /tmp/syscheck.dat 2>&1
date
dmesg
ioscan -fn
bdf
....all other commands you may need

The line 'exec > /tmp/syscheck.dat 2>&1' redirects all output and errors to file syscheck.dat, so you don't need to redirect every command in the script.

Best regards,

Dan

Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Klaus Knoch-Bader
New Member

Re: system check

Hi Chen and all others,

i think it's a good idea to check/integrate the syslog files too.
I would use the cron to start the script at several times.
Have fun !!
Walter
Walter Mefle