Redirecting Error Output
Hi can someone please guide me on how to redirect the standard error of a script into a file?
|
script-name 2> error.log
cheers |
This is an example of a cron job that redirects standard output and standard error of a script to a file called archive_backup.
#Archive Backup Log 01 7 1 * * /bin/bash -v /mnt/nfs-f13-live/my_scripts/archive_backup_log >>/home/bill/archive_backup.log 2>&1 |
thanxx guys it worked...i appreciate your help......
|
one more question :
how can i set error redirection within the script. i do not want to write scriptname.sh 2>error.log ,i just want to run the script normally like ./scriptname & want errors to be redirected in a file.Thanxx beforehand. |
For the errors to be trapped within the script you must write the redirects in the script and designate the error file. That way when you run your ./scriptname the errors generated within the script will be piped to the error file.
|
i've been trying to do that but i m getting syntax error each time.
|
What is the syntax error and command you are running?
|
All times are GMT -5. The time now is 08:59 AM. |