Re: leading null characters produced in script...
- From: "Avalon1178" <Avalon1178@xxxxxxx>
- Date: 31 Oct 2006 10:27:54 -0800
:Nope that does not work. I just tried it and leading nulls are still
:there....
That's very strange, because it's always worked for me, and it worked
fine when I tested it just now with:
while cat /etc/profile; do sleep 5; done | cat >/tmp/junk300
vs.
while cat /etc/profile; do sleep 5; done | cat >>/tmp/junk300
For the first case, if another process truncates the file, the writing
continues at the current offset and I end up with a file with a bunch
of NUL characters at the front.
For the second case (appending), the next write occurs at offset 0,
just as I believed it would.
Not sure why it didn't work for you. Is the output file on a locally
mounted filesystem? Perhaps this aspect of "append" breaks down for
files accessed via NFS.
--
Bob Nichols AT comcast.net I am "RNichols42"
Argh, I just wrote a long reply to this but when I tried to submitted
it returned an error! Oh well, let me see if I can recapture what I
posted:
Anyway, I'm thinking the reason it didn't work for me is probably
because of the nature of of my script and how I'm calling them.
../otherScript is actually called once to run in the background, rather
than called continuously in a loop (I didn't mention this earlier
because I didn't think it was relevant):
.....
../otherScript >$logFile 2>&1 &
../logScript $logFile 2>&1 &
......
../logScript is essentially the script that I wrote on my first post.
Notice there is no loop calling here. ./otherScript is run once to run
in the background, does whatever it does and writes output to $logFile.
./logScript meanwhile is also run in the background, archiving
$logFile when it reaches a certain size.
So per your suggestion, I tried this:
.....
../otherScript >>$logFile 2>&1 &
../logScript $logFile 2>&1 &
......
....and that didn't work.
But to fix my problem, I just ended up modifying ./otherScript so I can
control how $logFile is opened and closed. So now my invocation is as
follows:
.....
../otherScript $logFile 2>&1 &
../logScript $logFile 2>&1 &
.....
Maybe the way I'm invoking the scripts caused >> to not work? Not sure
about that....but I do know that it didn't work....
.
- References:
- Re: leading null characters produced in script...
- From: Robert Nichols
- Re: leading null characters produced in script...
- Prev by Date: Re: distribution that will allow for a minimal install
- Next by Date: Re: MP3 encoding for distribution
- Previous by thread: Re: leading null characters produced in script...
- Next by thread: insertion/removal of a Card in a Multi-Card USB Reader.
- Index(es):
Relevant Pages
|