Visit Our UNIX and Linux User Community

redirect errors to log file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting redirect errors to log file
# 1  
Old 02-26-2008
Question redirect errors to log file

I am working on a generic script that will run a shell script with the arguments passed and redirect errors to one file, and all other output to another file. Then if there is anything in the error file it emails the error to me, otherwise it exits.

The advantage for this approach is that I won't need to worry about doing error handling in each shell script. I will just know that any errors encountered will get sent to me.

How can I set up the redirect to send only errors to the error log and everything else to the log?



Previous Thread | Next Thread
Test Your Knowledge in Computers #240
Difficulty: Easy
In 1973, a transatlantic satellite link connected the Norwegian Seismic Array (NORSAR) to the ARPANET, making Norway the first country outside the US to be connected to the network.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Outputting Errors to a Log file

Good Morning, Every so often, I have copy scripts that to don't complete, but I don't immediately know why. It usually ends up being a permissions issue or a length issue. The scripts edit a log file, so I'd like to include any copy errors/issues in that file to check if the copies... (4 Replies)
Discussion started by: Stellaman1977
4 Replies

2. UNIX for Dummies Questions & Answers

[Solved] How to Redirect Output To Log File?

I have the below script, but when i execute it is still printing to screen is there a way i can stop this and just print everything to the log file. Thank you. #!/bin/bash exec > >(tee "/var/log/ScriptLogs/called_from_incrontab.log") 2>&1 DIR="$1" FILE="$2" echo "STEP 1: Datafile... (5 Replies)
Discussion started by: Ariean
5 Replies

3. Shell Programming and Scripting

Scan log file for errors

Hi everyone. I am still new to UNIX, and am having trouble figuring out how to create a script to scan a log file to look for errors based on a string. We run AIX 5.3, and would like the ability to report all the instances of WebSphere Broker Execution groups crashing. This script would... (8 Replies)
Discussion started by: jimbojames
8 Replies

4. Shell Programming and Scripting

Capturing errors messages into log file

Can we capture and write all the error messages which were being displayed on the command prompt screen during execution of a program into a log file? If yes, can anyone please let me know on how to do it? I am using ksh and working on AIX server. Thank you in advance. (4 Replies)
Discussion started by: vpv0002
4 Replies

5. Shell Programming and Scripting

track the errors in log file

OS: SuSE Linux Enterprise Server 10 Goal: To track the errors in log file, If they exits users will be notify by email. We have a script below: SrchKey="SRVE0242I:" LogFile=/PATHtemOut.log MailTo=" http:// ! -f PATH/alert.last && touch PATH/alert.last egrep $SrchKey $LogFile... (3 Replies)
Discussion started by: sdhn1900
3 Replies

6. HP-UX

how to redirect the growing contents of log file to another file in unix

how to redirect the growing contents of log file to another file in unix (2 Replies)
Discussion started by: megh
2 Replies

7. HP-UX

How to Redirect the error messages from Syslog file to our own Application Log File

Hello, I am New to Unix. I am Using HP-UX 9000 Series for my Application. I am Currently Facing an Issue that the error messages are being written in the syslog file instead of the Application Log File. The Codes for that Syslog.h is written in Pro*C. I want to know how to Redirect these... (3 Replies)
Discussion started by: balasubramaniam
3 Replies

8. Shell Programming and Scripting

Real time log file redirect

Hi all, i would like to write the shell script program, it can monitor the access_log "real time" when the access_log writing the line contain "abcdef" the program will be "COPY" this line into a file named "abcdef.txt", do the same thing if the contain "123456" "COPY" it into a file named... (3 Replies)
Discussion started by: eric_wong_ch
3 Replies

9. Shell Programming and Scripting

redirect output to log file

hello all, I'm invoking the program generate-report using backticks from my perl program and redirecting the output to the log file sge-stderr.log. But when i check the process using ps command it is spawing two processes where the below code is parent process and the program generate-report as... (2 Replies)
Discussion started by: kalyanraj
2 Replies

10. UNIX for Dummies Questions & Answers

redirect standard error into log file

Hi, I am new in shell scripting. Can anyone point out what wrong of below script. If I want the error output to "sqlerror.log" and database pool data output to "bulk_main.dat". Right now, the below script, if successful execute, the data will output to bulk_main.dat && sqlerror.log both... (7 Replies)
Discussion started by: epall
7 Replies
lsmsad(8)						      System Manager's Manual							 lsmsad(8)

lsmsad - Starts the Storage Administrator (SA) daemon SYNOPSIS
/usr/sbin/lsmsad DESCRIPTION
The SA daemon, lsmsad, is a process required by lsmsa, the SA graphical user interface (GUI). The daemon issues commands and obtains system information on behalf of SA. The SA daemon runs on a Tru64 UNIX system on which LSM is initialized and running. The SA client runs on any machine that supports the Java Runtime Environment. The SA daemon is automatically started at boot time. Under normal conditions, the daemon does not need to be run manually. If SA does not start during the boot process, enter: /sbin/init.d/lsmsa stop To restart SA, enter: /sbin/init.d/lsmsa start Only one SA daemon can be running on a system at a given time. If a second SA daemon attempts to start, it will fail. RESTRICTIONS
You must be root user to run lsmsad. FILES
The script that starts lsmsad at boot time. The command log file that tracks SA tasks. The access log file that tracks login to SA. The server log file that tracks server startup information and server errors. The log maintenance shell script that saves and compresses log files. SEE ALSO
lsmsa(8), volintro(8) lsmsad(8)

Featured Tech Videos