Appending a log file withough using the appendfile command

(imported topic written by RichB91)

For several reasons, I don’t like using the

appendfile

command to append lines to an existing log file.

  1. The entire file gets copied twice instead of just appending a line to the original file. I see this as an inefficient drive and CPU utilization.

  2. Especially for Fixlets or Tasks with longer than average running times, the chance that a non-BigFix process will write to the same log file between the time that the Task copies the original log file to the __appendfile and the time the Task copies the __appendfile back to the original log file is too high for my purposes.

  3. If a Task was designed to write to the log once at the beginning, the middle and the end of the task, but fails between the middle and the end, none of the log entries get written. If the log file was appended in real time (as each line is added) then at least the log entires at the beginning and middles would still be recorded.

How can I append (actually append, not just use the appendfile command) a line of text to an existing file in real time?

I think this works for Windows:

waithidden cmd.exe /C echo {“MyCustomText”} >> {"C:\Log.txt ")}

What is the equivalent for Unix?

Are there any alternate options for Windows?

Is there a single option that will work for both operating systems without relying on the appendfile command?

(imported comment written by NoahSalzman)

Unix equivalent would be something like this:

waithidden /bin/sh -c “echo ‘foo’ >> /blah/log.txt”

I haven’t tested the {relevance substitution} in that type of Action Script command… not sure if the quotes within quotes will work, give it a whirl and let us know.

(imported comment written by RichB91)

Thank you. I suspect that will work out.

As always, I appreciate the rapid reply.

-RichB