Re: Performance problem - Not able to write to file



Mark Hobley wrote:

#! /shell/nerd <vikasera@xxxxxxxxx> wrote:
I'm using KSH. Is there any way around this. It's really annoying. My
script works for say 10 machines but any greater connections it fails
while creating the file (using >> /tmp/out).

You need to secure a unique instance, before writing to the file:

That shouldn't be necessary with a POSIX-conforming shell.
The file should be opened with O_APPEND set, which will ensure
that no data is lost.

Some possible causes of the problem are:

1. The ksh that the OP is using doesn't set O_APPEND. Maybe clones
such as pdksh are like that; I doubt if any "real" ksh is.

2. The OP thinks the printf is being executed by ksh, but actually
it is being executed by a different shell.

3. The shell really is setting O_APPEND, and the underlying O/S has
a bug.

Before resorting to locking, the OP should at least try to find
out for sure whether O_APPEND is being set. On most systems he
should be able to do that using a tool such as truss or strace.

--
Geoff Clare <netnews@xxxxxxxxxxxxx>

.



Relevant Pages

  • Re: inclusion in a script shell
    ... > I'm writing a lot of shell script(AIX ksh) which use some common functions. ...
    (comp.unix.shell)
  • Re: inclusion in a script shell
    ... > I'm writing a lot of shell script(AIX ksh) which use some common functions. ...
    (comp.unix.shell)
  • Re: Add user in Unix from command Line
    ... This really only affects the login shell for root -- once logged in as ... Some are other shell scripts, some are .c and .h files, some are various ... And now I just plain do not use other shells while root on sco boxes, ... For a few years I used to change roots login shell to ksh, ...
    (comp.unix.sco.misc)
  • Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)
    ... :>: Are you saying that David Korn is an unitiated or ignorant ksh ... :> won't be called in a script. ... :> in every shell. ... that should be teached in every shell programming book. ...
    (comp.unix.shell)
  • Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)
    ... Are you saying that David Korn is an unitiated or ignorant ksh ... > You provided one obscure example that does not occur in scripts. ... > in every shell. ... that should be teached in every shell programming book. ...
    (comp.unix.shell)