How to redirect the import log to /dev/null?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to redirect the import log to /dev/null?
# 1  
Old 01-15-2009
How to redirect the import log to /dev/null?

Hi
i am running oracle database import through a script and script scans the import log to see if there are any errors.

Now the porblem is that when i run the script the import log appears on the screen even if i direct the output of import to /dev/null.

imp "'/ as sysdba'" file=${exp_file} log=${RUN_PATH}/imp_${db}_${dt}.log parfile=config.par > /dev/null

i tried adding 2>&1 > /dev/null to the end but then the log appears in the log file instead of the screen ,which the script builds with

exec > ${RUN_PATH}/db_exp_full.log

i dont want the log either on the screen or the log file.I will just scan the log file for errors ,if any, mentioned in the log parameter of imp above.

Any ideas?
# 2  
Old 01-15-2009
Code:
imp "'/ as sysdba'" file=${exp_file} log=${RUN_PATH}/imp_${db}_${dt}.log parfile=config.par > /dev/null

Quote:
i tried adding 2>&1 > /dev/null to the end but then the log appears in the log file instead of the screen ,which the script builds with...

It should be added like this:
Code:
imp "'/ as sysdba'" file=${exp_file} log=${RUN_PATH}/imp_${db}_${dt}.log parfile=config.par >/dev/null 2>&1

# 3  
Old 01-15-2009
Yup it worked but could you please expalin how.
# 4  
Old 01-15-2009
Alright, so here is how error redirection works..

As you know, to send the STDOUT to /dev/null you do something like this: somecmd > /dev/null

So, to send STDERR to the same place, you can do:
somecmd 2> /dev/null

To send both STDOUT and STDERR to /dev/null you can do:
somecmd > /dev/null 2>&1

the 2 is writing to the same place that 1 is (which is dev null).. The &1 means "Whatever 1 is writing to".

Hopefully that explains it a bit better. Smilie
# 5  
Old 01-15-2009
Redirect any (error or ...) message [2] to standard output [1] as standard output went to /dev/null... So syntax is cmd cmd...>file 2>&1 (As for crontab lines: either you redirect in 2 separate files or you >toLogfile 2>&1 )
# 6  
Old 01-15-2009
thanks everyone...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Redirect Standard Error to /dev/null is not working.

Hello. When I run a .ksh that contains the command below, and there is no file available in the source location the "FILE_NAME_*.CSV not found" error is still being displayed. FILEN=$(ssh ${SOURCE_SERV} "cd ${SOURCE_LOCATION} ;ls ${FILES}") 2> /dev/null. This is interfering with the rest... (4 Replies)
Discussion started by: jimbojames
4 Replies

2. Shell Programming and Scripting

Help with /dev/null Please

Hello All and a Happy New year to yous guys. I'm running the below command on my AIX box and it keeps giving me the message that the file doesn't exist. I know the file don't exist, but I don't want to see the error. 2>/dev/null doesn't work. bash-3.00$ ls -l C* | wc -l 2>/dev/null ls:... (2 Replies)
Discussion started by: bbbngowc
2 Replies

3. Shell Programming and Scripting

redirect the audio output to /dev/null

I'm using an text-to-speech synthesis in a script, and I need to redirect it's output to /dev/null how can I do that ? And how to redirect the stream to his normal output then (sound card ) ? thankx (2 Replies)
Discussion started by: firelink
2 Replies

4. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

5. UNIX for Dummies Questions & Answers

/dev/null 2>&1 Versus /dev/null 2>1

How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&" echo "hello" > /dev/null 2>&1 echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies

6. Shell Programming and Scripting

/dev/null

Hi expert, May I know what is the difference between below cron tab entry ? 0,12 * * * * /abc/myscript.sh > /dev/null 2>&1 0,12 * * * * /abc/myscript.sh (7 Replies)
Discussion started by: olaris
7 Replies

7. Solaris

What is /dev/tty /dev/null and /dev/console

Hi, Anyone can help My solaris 8 system has the following /dev/null , /dev/tty and /dev/console All permission are lrwxrwxrwx Can this be change to a non-world write ?? any impact ?? (12 Replies)
Discussion started by: civic2005
12 Replies

8. UNIX for Dummies Questions & Answers

redirect stderr and/or stdout to /dev/null from command line

Is it possible to redirect errors at the command line when you run the script such as bash scriptname & 2>/dev/null? (1 Reply)
Discussion started by: knc9233
1 Replies

9. Shell Programming and Scripting

redirect stderr to dev/null in bash env.

Working in a bash environment, in the following example, how do I direct the error message that putting in an invalid flag (-j for example) would normally produce to dev/null? while getopts "abcd" opt do case "$opt" in i) a etc ;; r) b etc ;; f) c etc ;; v) d... (7 Replies)
Discussion started by: Sniper Pixie
7 Replies

10. UNIX for Dummies Questions & Answers

>/dev/null

Maybe it's an stupid question but remeber... I'm Junior.. I use command line to run programs, and some of them gives a lot of information when, for example, you open a window or other actions. That's really bad because my terminal gets full of unwanted messages, so I use "bin file & >/dev/null"... (1 Reply)
Discussion started by: piltrafa
1 Replies
Login or Register to Ask a Question