Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2008, 11:54 AM
bine
 
Posts: n/a
Default Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written to by other processes explicitly?

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-05-2008, 11:54 AM
bsh
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written to by other processes explicitly?

On Nov 13, 2:05 am, bine <sabine.hubrig-schaumb...@sungard.de> 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/sh...hynot/;http://
www.cs.uleth.ca/~holzmann/C/shells/csh.avoidit,$0,"webpage","Tom
Christiansen" <tchrist@wraeththu.cs.colorado.edu>

"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/...408f/0408f.htm
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. <http://www.unixreview.com/documents/s=9823/sam0508h/
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/newslette...003-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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 11:54 AM
bine
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written to by other processes explicitly?

On 14 Nov., 03:46, bsh <brian_hi...@rocketmail.com> wrote:
> On Nov 13, 2:05 am, bine <sabine.hubrig-schaumb...@sungard.de> 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-whynot/;http://www.cs.uleth.ca/~holzmann/C/shells/csh.avoidit,$0,"webpage","Tom
> Christiansen" <tchr...@wraeththu.cs.colorado.edu>
>
> "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/...04/aug2004.zip
> Schaefer, Ed and John Spurgeon. "Queuing Jobs with qjob". 2005-07. Sys
> Admin. 14(8):XXX. <http://www.unixreview.com/documents/s=9823/sam0508h/
> 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/mklockhttp://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- 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-05-2008, 11:54 AM
Hajo Ehlers
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to in shellscripts and prevents them to be written to by other processes explicitly?

On Nov 13, 11:05 am, bine <sabine.hubrig-schaumb...@sungard.de> 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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-05-2008, 11:54 AM
bsh
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to inshellscripts and prevents them to be written to by other processes explicitly?

bine <sabine.hubrig-schaumb...@sungard.de> wrote:
> I miss some informations I write to a file.
> bsh <brian_hi...@rocketmail.com> wrote:
> > ...
> > I cannot tell by your description whether you do or do not
> > ultimately require _either_ serialization or just successful
> > writes to "mylog" of your "other scripts".


> 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.


I thought you would say that. All my experiences with past
AIX idiosyncrasies have been bad -- I try to avoid this OS as
much as possible, so I am skeptical that there is an easy fix.
However, I did some research and asked around, and here is what
I have been able to determine:

(1) I can find no (obvious) file-locking configuration
either in smit or smitty. Perhaps it's there, but no luck.

(2) Investigate "AIX Fast Connect"
$ net config /parameter_namearameter_value
configuration file: /etc/cifs/cifsConfig
investigate parameters: oplock_unix_lock, oplock_unix_lock_timeout,
oplockfiles, and oplocktimeout

(3) Investigate "Basic Networking Utilities (BNU)":
configuration directory: /etc/locks/

Are your processes long duration? OS-level file-locking could
be timing out. Also, is mylog on an NFS mount? AIX4 has a bug
that buffered I/O does not work properly with file locking.

"Understanding Locking":
http://publib.boulder.ibm.com/infoce...tc/locking.htm

Are you the system administrator of this system? Is there no
local expert to confer with? I recommend posting to the
newsgroup comp.unix.aix.

Perhaps the only practical recourse is to utilize an
external manager:

"dbappend.c": robust, serialized, recoverable appending to file
http://www.johncon.com/john/archive/dbappend.shar.gz
http://www.johncon.com/john/archive/dbappend.txt

=Brian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-05-2008, 11:54 AM
Mark Taylor
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to inshellscripts and prevents them to be written to by other processes explicitly?

it may not be the silver bullet, but have you tried this yet ?

http://publib.boulder.ibm.com/infoce...erf_tuning.htm

Rgds
Mark Taylor

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-05-2008, 11:54 AM
bine
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to inshellscripts and prevents them to be written to by other processes explicitly?

On 14 Nov., 19:44, Hajo Ehlers <serv...@metamodul.com> wrote:
> On Nov 13, 11:05 am, bine <sabine.hubrig-schaumb...@sungard.de> 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- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -


thanks to you guys, I will have a look into all those ideas ...
just some quick answers to some of your questions:

- AIX is not avoidable (due to our customers requests) as much as I'd
like ;-(

- I'm not the administrator so I can't try everything, but
unfortunately there's no other expert than me ;-) [or to more precise
";-(" ]

- mylog is not on NFS

- the csh starting the process using >>& is running "long" that is
normally some hours as it's kind of a demon to serve requests when
they are entered in the databasetables (and start script to do so,
which fail to put their (short) messages into the same mylog

- using tcsh would mean to change a lot of scripts which now start
with #!/bin/csh (because I couldn't rely on csh being linked to tcsh
on all [customer's] machines...) but of course it would be worth a try
for testing the effect only with my environment to eliminate that idea

- I'm sure that no process does >mylog because the start-messages of
the process the csh starts and others of that ARE in the file, only
those of other processes writing >>mylog fail to do so, so there's no
"over"writing of mylog but just a "non"writing to mylog

- hajo's 4th point is my favourite, that is: a buffer of 4K which
never gets

thank you guys so far
and if I detect something I'll post it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-05-2008, 11:54 AM
Geoff Clare
 
Posts: n/a
Default Re: Is AIX locking files used to redirect stdout+err to inshellscripts and prevents them to be written to by other processesexplicitly?

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 <netnews@gclare.org.uk>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:06 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491</