bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems with output redirection


From: Verena Alishahi
Subject: Re: problems with output redirection
Date: Wed, 02 Apr 2008 11:53:26 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080226)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Bert,

thank you for your suggestion. The way to redirect only from local.sh is
working.
I thought this wouldn't work, because in my original script remote.sh I
also redirect to another temporary output-file. In this case I was wrong.

Thank you very much!

best regards,
Verena

Bert Barbe wrote:
| With local and locally I mean ofcourse on the host that is running
local.sh
| e.g;. change local.sh to do
| ssh $HOST $REMOTE_SKRIPT >>$OUTPUT
| and remove the redirection to $OUTPUT in remote.sh
|
| Bert
|
| Bert Barbe wrote:
|> Interesting would be to see how the file looks like on the other hosts ;)
|> Maybe the file is being extended on the remote host first but the
|> write() isn't synced before the local host writes again.
|> Why not redirect the output off ssh locally so that all writes are
|> local ? That is if the output isn't huge ofcourse.
|> I would imagine this is more of an nfs issue than a bash issue.
|>
|> Regards,
|> Bert
|>
|> Verena Alishahi wrote:
| Dear list-members,
|
| last week I've updated my workstation cluster client (amd 64 bit) from
| SuSE 10.0 to openSUSE 10.3. My bash-version is 3.2.25(1)-release.
|
| Now I've problems with a bash script, which I used (with bash 3.1) for
| years without any problems. I really don't understand what's going on.
|
| I've reduced my original script to a minimal script which reproduces the
| output redirection error. The script works as follows:
|
| My first script (local.sh) reads a list of worksation cluster clients
| from hosts.inp in a loop and prints some output to output.txt. In the
| loop a second script (remote.sh) is called in a ssh instruction.
| remote.sh then writes some output to the same output.txt file, but this
| output doesn't reach the output file correctly.
|
| Both the bash-scripts and the output file are stored on an
| NFS-Filesystem (on the workstation cluster server), so every client can
| access them.
|
| | less hosts.inp
| client1
| client2
| client3
| client4
|
| | less local.sh
| #!/bin/bash
| OUTPUT=$HOME/bashtest/output.txt
| INPUT_HOSTS=$HOME/bashtest/hosts.inp
| REMOTE_SKRIPT=$HOME/bashtest/remote.sh
| echo "created from $HOME/bashtest/local.sh" > $OUTPUT
| for HOST in `cat $INPUT_HOSTS`
| do
| ~  echo $HOST >> $OUTPUT
| ~  ssh $HOST $REMOTE_SKRIPT
| ~  echo "" >> $OUTPUT
| done
|
| | less remote.sh
| #!/bin/bash
| OUTPUT=$HOME/bashtest/output.txt
| echo "TEST2" >> $OUTPUT
|
| | less output.txt
| created from /home/user1/bashtest/local.sh
| client1
| address@hidden@address@hidden@address@hidden@
| client2
| address@hidden@address@hidden@address@hidden@
| client3
| address@hidden@address@hidden@address@hidden@
| client4
| address@hidden@address@hidden@address@hidden@
|
|
| Instead of all the address@hidden@address@hidden@address@hidden@ rows, 
output.txt should contain the text
| TEST2
| less thinks output.txt were a binary file.
| I don't understand, why the output-redirection in remote.sh doesn't
| work. If I do the output-redirection in remote.sh to another file, for
| example
| OUTPUT2=$HOME/bashtest/output2.txt
| echo "TEST2" >> $OUTPUT2
| then it works.
| The output-redirection only fails, when the redirection is to the same
| file which is also be written from local.sh.
|
| I appreciate receiving any help.
|
| best regards,
| Verena Alishahi
|>>
|>>
- -------------------------------------------------------------------
- -------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich
|>>
Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Bärbel Brumme-Bothe
Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
- -------------------------------------------------------------------
- -------------------------------------------------------------------
|>>
|>>
|>
|>

- --

Verena Alishahi

Institut für Chemie und Dynamik der Geosphäre
ICG-1: Stratosphäre
Tel.: +49 2461 61-6221
E-Mail: address@hidden

- --------------------------------------------------------------------------
- --------------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich

Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDirig'in Bärbel Brumme-Bothe
Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender), Dr. Ulrich Krafft
(stellv. Vorsitzender); Dr. Sebastian M. Schmidt
- --------------------------------------------------------------------------
- --------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFH81eWB/rJPqfoUGARAk1zAKDOqfYnybaRIG+x7ju8UGJUVZqagACgjr0X
BEM4vJgkCmSzxDXwYlc7bPo=
=7mdx
-----END PGP SIGNATURE-----


-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich

Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Bärbel Brumme-Bothe
Geschäftsführung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]