Output to log file
Being a newbe over 50, I need to be able to send the output of a *.sh script to a Log file when it completes. What is the syntext?
Thanks, Bill |
there is no real syntax for this at all, other than just doing a redirect, i.e. "myscript.sh > logfile.txt". That would redirect all the standard output, but you'd probably also want the standard error, in which case expand it slightly to "myscript.sh 2>&1 > logfile.txt".
You might like to have a slicker method though and use the logger command within your script to send log messages directly into syslog, which you could then pull out via your syslog config into it's own file, or just let it hit /var/log/messages by default. |
All times are GMT -5. The time now is 09:21 PM. |