Error Log


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error Log
# 1  
Old 08-04-2013
Linux Error Log

How can the error log be captured.

I have a SSH script which is getting df -h output to a file but when the server is not responding or cannot connect I want to capture those server details but I'm not able to do that with the below script.

Code:
 
#! /bin/ksh
PARMFILE=/opt/fdw/scripts/db_scripts/idsgsup/tylx/server_list1.txt
for server in $(<server_list1.txt)
do
    ssh -q $server df -Pk -h | tail -n +2 | sed -e "s/ \+/,/g" -e "s/$/,$server/g" -e "s/,on,$server/ on,Servername/" | column -s"," -t >> df1.out
      
              [[ ! $? = 0 ]] && echo Failure, errno $?, cannot connect to host "$server" >> sshfailed.list
done
sed -r -i 's/\s+/ /g' df1.out | sed -i 's/\ /,/g' df1.out  | awk '{ OFS=","; print $1,$2,$3,$4,$6,$7}' df1.out >> df2.out

Any help is appreciated
# 2  
Old 08-04-2013
redirect stderr output to the error log file ... actually see your original post ...
Code:
ssh -q $server "some command" > log 2> errlog

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Print Error in Console and both Error & Output in Log file - UNIX

I am writing a shell script with 2 run time arguments. During the execution if i got any error, then it needs to redirected to a error file and in console. Also both error and output to be redirected to a log file. But i am facing the below error. #! /bin/sh errExit () { errMsg=`cat... (1 Reply)
Discussion started by: sarathy_a35
1 Replies

2. Web Development

How to log http 404 error to a separate log file?

Apache Web Server: how to log http 404 error to a separate log file and i do not want to log in access.log please advice. (2 Replies)
Discussion started by: raghur77
2 Replies

3. Solaris

Log error from cron job into log file

Hi Please would it be right to log the errors from a script running in cron in the following manner: /datax/vendor/dump.sh > /datax/vendor/err.log 2>&1 (16 Replies)
Discussion started by: fretagi
16 Replies

4. Shell Programming and Scripting

What is this error log = hda: irq timeout: error=0x00 and how to solve?

what is this error log = hda: irq timeout: error=0x00 and how to solve? every day upon checking the logs i see this error. hda: irq timeout: error=0x00 hda: irq timeout: error=0x00 hda: irq timeout: error=0x00 hda: irq timeout: error=0x00 hw_client: segfault at 0000000000000046 rip... (3 Replies)
Discussion started by: avtalan
3 Replies

5. UNIX for Dummies Questions & Answers

FTP error log

Hi I'm here again. This time I have a question that is not a really issue because I 've already found a workaround but I don't know if the behaviour is correct or not. In my ksh shell I open a sftp connection to a remote machine. this is the code: sftp ${Csi_USER}@${Csi_HOST}<<EOF0 >>... (1 Reply)
Discussion started by: leobdj
1 Replies

6. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

7. Shell Programming and Scripting

Appending error messages from log file next to the corresponding error record

Hi Everyone, I have an issue and trying to get a solution but was not succesful yet. Any help is greatly appreciated. I am using ksh to inoke sql loader to load data from txt file into two oracle tables based on the condition written in the control file. If an error occurs while loading into... (8 Replies)
Discussion started by: vpv0002
8 Replies

8. Shell Programming and Scripting

grep only last occurred error in error.log,

hi folk i need your help to find one logic.... i have error log same as any other error logs which get populated by no of events and errors... but i need to grep the last occured errors.. which cant be duplicate. here is my script. ======================== #!/usr/bin/ksh grep -i... (3 Replies)
Discussion started by: tapia
3 Replies

9. Shell Programming and Scripting

sqlplus error output to different error log file

HELLO, I am using such a command to write oracle sqlplus query result to text file: sqlplus -S xxx/xxx@xxxxxxx @\tmp\2.sql>\tmp\123.txt Is it possible to script that: If command succesfull write in \tmp\log.txt: timestamp and "succeded" and create 123.txt with results else If error... (2 Replies)
Discussion started by: tomasba
2 Replies

10. AIX

Can't clear error log

Hi errclear seems not working on aix 4.3/rs6k, i can't clear HW error with errclear -d H 0 ??? what is wrong ? thanks. (0 Replies)
Discussion started by: andryk
0 Replies
Login or Register to Ask a Question