![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What's The Easiest Route To Creating A Unix Executable File for Terminal? | unimachead | OS X (Apple) | 10 | 2 Weeks Ago 09:40 AM |
| Route the logs to different file other than nohup.out | pinky | UNIX for Dummies Questions & Answers | 6 | 03-14-2008 08:48 AM |
| Error: No Route to host...urgent {socket() connection} | arunchaudhary19 | High Level Programming | 6 | 10-30-2007 01:10 AM |
| Add Route on HP-UX v10.x, help. | efrenba | HP-UX | 4 | 04-06-2007 05:26 AM |
| Error: Internal system error: Unable to initialize standard output file | firkus | UNIX for Dummies Questions & Answers | 2 | 10-25-2005 12:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How to route error to log file in unix
Hey Every one
I have a find statement which find the files and deletes them find /web/local/orderlink/batchmanaged01/scripts/SMOappLogs/log -name 'orderlink.log.*' -type f -mtime +$10-exec rm -f {} \; This statement if finds a file at the given location it will delete the files but if it doesn't find files at the given path on the server then throws error saying find: /web/local/orderlink/batchmanaged01/scripts/SMOappLogs/log: No such file or directory I want to route this error to log file rather than displaying in the place where I executed the script my log file declaration is DIRNAME=`dirname $0` LOGFILE=$DIRNAME/auto_purge.log I want it to route the error to log file auto_purge.log located in the same directory structure Thanks for the answers Pinky |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
find /web/local/orderlink/batchmanaged01/scripts/SMOappLogs/log -name 'orderlink.log.*' -type f -mtime +$10-exec rm -f {} \; 2>$LOGFILE
|
|
#3
|
|||
|
|||
|
Hi Thanks for hte answer it worked
But the problrm is I am able to see the error in log file but I am also seeing as std output at the place where I ran the script I want to route the error to log file and should not display it at the place where I ran can you plz help me to get this done Thanks Pinky |
|
#4
|
||||
|
||||
|
Not entirely sure what you mean - redirecting STDERR to the log should suffice:
Code:
$ find sdkasd -name "asdasd" find: sdkasd: No such file or directory $ find sdkasd -name "asdasd" 2>logfile $ cat logfile find: sdkasd: No such file or directory Cheers, ZB |
|
#5
|
|||
|
|||
|
Thanks it worked You guys are very helpful.
Regards Pinky |
|||
| Google The UNIX and Linux Forums |