Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written
Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written
am 13.11.2007 11:05:52 von bine
I have the confusing fact that in contrary to Linux (UnitedLinux or
SuseEnterpriseServer)
I miss some informations I write to a file.
It seems that defining this file to be used for stdout+stderr in a csh-
call like in
myprog ... >>& mylog
prevents later in the callhirarchy,
that is by things called from myprog,
and other scripts running in parallel as well
(because this csh is running with nohup parallel to those)
to put their output explicitly, e.g. by
echo ... >> mylog
into the same file.
Is there some parameter or "set" command to make AIX behave like the
others?
I know that if those messages REALLY come in parallel, there MUST be
some conflict
due to the serialization of the output, so I might get things in a
"wrong" order
(I really don't want to discuss if this application is very
sophisticated
or should be modernized/recoded to a certain extent ;-),
but I miss EVERYTHING of the other processes, not only some of the
letters,
so the question occurs if it's a configurable behavior of AIX?
The highest level of any bos.*-module of the machine in lslpp-output
is 5.3.0.61,
but I think the behaviour hasn't changed and was the same (and always
frustrating) in former releases?
Thanks in advance
bine
Re: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be writ
am 14.11.2007 03:46:23 von brian_hiles
On Nov 13, 2:05 am, bine wrote:
> I have the confusing fact that in contrary to Linux (UnitedLinux or
> SuseEnterpriseServer)
> I miss some informations I write to a file.
> It seems that defining this file to be used for stdout+stderr in a csh-
> call like in
> myprog ... >>& mylog
> prevents later in the callhirarchy,
> that is by things called from myprog,
> and other scripts running in parallel as well
> (because this csh is running with nohup parallel to those)
> to put their output explicitly, e.g. by
> echo ... >> mylog
> into the same file.
>
> Is there some parameter or "set" command to make AIX behave like the
> others?
> I know that if those messages REALLY come in parallel, there MUST be
> some conflict
> due to the serialization of the output, so I might get things in a
> "wrong" order
> (I really don't want to discuss if this application is very
> sophisticated
> or should be modernized/recoded to a certain extent ;-),
> but I miss EVERYTHING of the other processes, not only some of the
> letters,
> so the question occurs if it's a configurable behavior of AIX?
>
> The highest level of any bos.*-module of the machine in lslpp-output
> is 5.3.0.61,
> but I think the behaviour hasn't changed and was the same (and always
> frustrating) in former releases?
>
> Thanks in advance
> bine
I cannot tell by your description whether you do or do not
ultimately require _either_ serialization or just successul
writes to "mylog" of your "other scripts". Only for SGI Irix
can I specifically say that shell-level output redirection
is written line-by-line atomically. For other OSes I cannot
say what the behavior is or should be.
The common wisdom is that t/csh is problematic for scripting
purposes; under AIX and anything goes! ;)
D,"comp.unix.shell -- Csh Programming Considered Harmful",
1993-08-11,http://www.faqs.org/faqs/unix-faq/shell/csh-whyno t/;http://
www.cs.uleth.ca/~holzmann/C/shells/csh.avoidit,$0,"webpage", "Tom
Christiansen"
"Csh Programming Considered Harmful"
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
I know it's more than you want to do, but for robust and
portable coding, not relying on the underlying I/O of your
OS, you will want to explicitly control process serialization.
The best overall library I have found and used is:
"semaphore.ksh" and "qjob.ksh":
http://www.unixreview.com/documents/s=9303/sam0408f/0408f.ht m
http://www.samag.com/code/
ftp://ftp.mfi.com/pub/sysadmin/2004/aug2004.zip
Schaefer, Ed and John Spurgeon. "Queuing Jobs with qjob". 2005-07. Sys
Admin. 14(8):XXX.
0508h.htm>.
There are a zillion others of inferior quality, but are
perhaps better suited to simpler demands -- just do a search
in C.U.S. or try:
"mklock.sh"
http://www.shelldorado.com/scripts/quickies/mklock
http://www.shelldorado.com/newsletter/issues/2003-1-Jul.html
"lock_unlock.ksh"
http://www.unixlabplus.com/unix-prog/lock_unlock/
http://www.unixreview.com/documents/s=9040/ur0402g/
.... and so on. Note that absolutely none of them are t/csh
scripts....
=Brian
Re: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be writ
am 14.11.2007 18:41:02 von bine
On 14 Nov., 03:46, bsh wrote:
> On Nov 13, 2:05 am, bine wrote:
>
>
>
>
>
> > I have the confusing fact that in contrary to Linux (UnitedLinux or
> > SuseEnterpriseServer)
> > I miss some informations I write to a file.
> > It seems that defining this file to be used for stdout+stderr in a csh-
> > call like in
> > myprog ... >>& mylog
> > prevents later in the callhirarchy,
> > that is by things called from myprog,
> > and other scripts running in parallel as well
> > (because this csh is running with nohup parallel to those)
> > to put their output explicitly, e.g. by
> > echo ... >> mylog
> > into the same file.
>
> > Is there some parameter or "set" command to make AIX behave like the
> > others?
> > I know that if those messages REALLY come in parallel, there MUST be
> > some conflict
> > due to the serialization of the output, so I might get things in a
> > "wrong" order
> > (I really don't want to discuss if this application is very
> > sophisticated
> > or should be modernized/recoded to a certain extent ;-),
> > but I miss EVERYTHING of the other processes, not only some of the
> > letters,
> > so the question occurs if it's a configurable behavior of AIX?
>
> > The highest level of any bos.*-module of the machine in lslpp-output
> > is 5.3.0.61,
> > but I think the behaviour hasn't changed and was the same (and always
> > frustrating) in former releases?
>
> > Thanks in advance
> > bine
>
> I cannot tell by your description whether you do or do not
> ultimately require _either_ serialization or just successul
> writes to "mylog" of your "other scripts". Only for SGI Irix
> can I specifically say that shell-level output redirection
> is written line-by-line atomically. For other OSes I cannot
> say what the behavior is or should be.
>
> The common wisdom is that t/csh is problematic for scripting
> purposes; under AIX and anything goes! ;)
>
> D,"comp.unix.shell -- Csh Programming Considered Harmful",
> 1993-08-11,http://www.faqs.org/faqs/unix-faq/shell/csh-whyno t/;http://www.cs.uleth.ca/~holzmann/C/shells/csh.avoidit,$0, "webpage","Tom
> Christiansen"
>
> "Csh Programming Considered Harmful"http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
>
> I know it's more than you want to do, but for robust and
> portable coding, not relying on the underlying I/O of your
> OS, you will want to explicitly control process serialization.
> The best overall library I have found and used is:
>
> "semaphore.ksh" and "qjob.ksh":http://www.unixreview.com/documents/s=9303/sam040 8f/0408f.htmhttp://www.samag.com/code/ftp://ftp.mfi.com/pub/ sysadmin/2004/aug2004.zip
> Schaefer, Ed and John Spurgeon. "Queuing Jobs with qjob". 2005-07. Sys
> Admin. 14(8):XXX.
> 0508h.htm>.
>
> There are a zillion others of inferior quality, but are
> perhaps better suited to simpler demands -- just do a search
> in C.U.S. or try:
>
> "mklock.sh"http://www.shelldorado.com/scripts/quickies/mkloc khttp://www.shelldorado.com/newsletter/issues/2003-1-Jul.htm l
>
> "lock_unlock.ksh"http://www.unixlabplus.com/unix-prog/lock_u nlock/http://www.unixreview.com/documents/s=9040/ur0402g/
>
> ... and so on. Note that absolutely none of them are t/csh
> scripts....
>
> =Brian- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
thanks brian,
I do not require absolute serialization of the outputs, I risk to have
some lines mixed, but at the moment i MISS a lot of output which
brought me to the idea that on AIX there might be some locking-
mechanism involved whereras on my other systems I get the lines.
And I have no chance to recode that stuff so I was just looking for
some "kernel"parameter (smit ... whatsoever) where I might hve
influence on that behaviour.
but thank you anyway for at least a reaction
bine
Re: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be writ
am 14.11.2007 19:44:14 von Hajo Ehlers
On Nov 13, 11:05 am, bine wrote:
> I have the confusing fact that in contrary to Linux (UnitedLinux or
> SuseEnterpriseServer)
> I miss some informations I write to a file.
> It seems that defining this file to be used for stdout+stderr in a csh-
> call like in
> myprog ... >>& mylog
> prevents later in the callhirarchy,
> that is by things called from myprog,
> and other scripts running in parallel as well
> (because this csh is running with nohup parallel to those)
> to put their output explicitly, e.g. by
> echo ... >> mylog
> into the same file.
>
> Is there some parameter or "set" command to make AIX behave like the
> others?
> I know that if those messages REALLY come in parallel, there MUST be
> some conflict
> due to the serialization of the output, so I might get things in a
> "wrong" order
> (I really don't want to discuss if this application is very
> sophisticated
> or should be modernized/recoded to a certain extent ;-),
> but I miss EVERYTHING of the other processes, not only some of the
> letters,
> so the question occurs if it's a configurable behavior of AIX?
>
> The highest level of any bos.*-module of the machine in lslpp-output
> is 5.3.0.61,
> but I think the behaviour hasn't changed and was the same (and always
> frustrating) in former releases?
>
> Thanks in advance
> bine
1 )Provide a stripped down version of your scripts which does
reproduce the problem
2) AFAIK is csh depreciated for shell programming. Go at least for the
tcsh and see if you have the same problem.
3) You are really sure that no process is writing with > to your
output file ?
4) I believe i have seen some problems with csh and pipes and grep
where the buffer was not flushed if the data was not getting larger
then 4k meaning the script output never left the buffer.
hth
Hajo
Re: Is AIX locking files used to redirect stdout+err to inshellscripts and prevents them to be writt
am 15.11.2007 15:03:39 von Geoff Clare
bine wrote:
> I have the confusing fact that in contrary to Linux (UnitedLinux or
> SuseEnterpriseServer)
> I miss some informations I write to a file.
> It seems that defining this file to be used for stdout+stderr in a csh-
> call like in
> myprog ... >>& mylog
> prevents later in the callhirarchy,
> that is by things called from myprog,
> and other scripts running in parallel as well
> (because this csh is running with nohup parallel to those)
> to put their output explicitly, e.g. by
> echo ... >> mylog
> into the same file.
One possibility is that csh on AIX might not set O_APPEND for
fd 1, it could just seek to the end before executing myprog.
In that case, using: sh -c 'myprog ... >> mylog 2>&1'
to start myprog would stop myprog (and things called from it,
assuming they write to stdout rather than reopening the log)
from overwriting the output from the other scripts. However,
the scripts, if also using csh, could still overwrite output
from myprog (and things called from it), and from each other.
--
Geoff Clare