best logging method for scripts

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-12-2010 01:51 PM
I have been scrapping my scripts and combining them all into 1 post image script for configurations that are just needed. What I cannot do in MCX I do via shell scripts. However, combining them all racks up like 500 lines of code sometimes. I would like the output of all commands to log to a log file, and remain there unless the script finishes. The last line in the script wipes out the log files. I have looked at the logger command, tee, script, using stdout, and so forth.
Not really sure the best way to go. Also, anyone know how to say have it populate the imaging logs in the JSS? That would be nice too, as sometimes I remotely image machines.
Thanks
Tom

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-12-2010 02:58 PM
I have been scrapping my scripts and combining them all into 1 post image
script for configurations that are just needed. What I cannot do in MCX I
do via shell scripts. However, combining them all racks up like 500 lines
of code sometimes. I would like the output of all commands to log to a
log file, and remain there unless the script finishes. The last line in the
script wipes out the log files. I have looked at the logger command, tee,
script, using stdout, and so forth.
Not really sure the best way to go. Also, anyone know how to say have it
populate the imaging logs in the JSS? That would be nice too, as sometimes
I remotely image machines.
I like this method for having a script log.
set -xv; exec 1>/Location/to/save/log.txt 2>&1
This shows the line that's executed and then under that shows any messages
coming back from the command. Cant help you with populating the JSS logs
though. HTH
- JD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-13-2010 11:55 AM
Okay, I can plug through scripts fairly well, but I'm a little unsure on
this. Where exactly in a shell script would you put this line? Would it go
at the top of the script?
Steve Wood
Director of IT
swood at integer.com
The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-13-2010 04:31 PM
I put it where I would have my very first command, I believe that is starts
logging from the point that it is ran, very handy.
--
Alan Benedict
?
Macintosh Technician
The Integer Group
http://www.integer.com

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 08-16-2010 09:05 AM
Yes, I put this right after my shebang line so it will log every command
from that point down.
- JD
