Sponsored Content
Top Forums Shell Programming and Scripting while read, is not looping with ssh. Post 302450704 by riegersteve on Friday 3rd of September 2010 01:40:42 PM
Old 09-03-2010
while read, is not looping with ssh.

echo will print all the lines, ssh will not. see below. why is this.

Code:
[root@localhost script]# awk -F: '{print $1,$2,$3}' vfiler_volumes.list | while read filer vfiler vol ; do echo $filer $vfiler $vol ; done
node1 vfiler0 /
node1 vfiler2 /vol/vfiler2_vol0
node1 vfilert /vol/vfiler_vol
node1 vfilert /vol/virt_vol


[root@localhost script]# awk -F: '{print $1,$2,$3}' vfiler_volumes.list | while read filer vfiler vol ; do ssh $filer vfiler run $vfiler df -h $vol ; done

===== vfiler0
Filesystem               total       used      avail capacity  Mounted on
/vol/vol0/               241MB      106MB      135MB      44%  /vol/vol0/
/vol/vol0/.snapshot        0MB       16MB        0MB     ---%  /vol/vol0/.snapshot
[root@localhost script]#

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

looping a array inside inside ssh is not working, pls help

set -A arr a1 a2 a3 a4 # START ssh -xq $Server1 -l $Username /usr/bin/ksh <<-EOS integer j=0 for loop in ${arr} do printf "array - ${arr}\n" (( j = j + 1 )) j=`expr j+1` done EOS # END ========= this is not giving me correct output. I... (5 Replies)
Discussion started by: reldb
5 Replies

2. Shell Programming and Scripting

Cannot read variables after ssh with rc file (KSH)

Greetings all, I'm currently making use of the $HOME/.ssh/rc file to launch an automated shell script immediately after the user has been verified through ssh. The current problem that I'm facing now is that I am unable to use the "read" command anymore... seems like the "read" statements are... (0 Replies)
Discussion started by: rockysfr
0 Replies

3. Shell Programming and Scripting

read line and ssh

Hi, I 'd like have a script to ssh to a list of hosts from a file name hosts_list. However, the script seem to exit out from the first line of the file #!/bin/bash X="hosts_list"; while read LINE do echo $LINE ssh $LINE hostname done < $X hosts_list file content: linux1 linux2... (3 Replies)
Discussion started by: phamp008
3 Replies

4. Fedora

ssh command to read server resources

what is the ssh command to read my server resources, like system operator, Ram installed, CPU etc....? (12 Replies)
Discussion started by: dan8354544
12 Replies

5. Shell Programming and Scripting

[Solved] Not able to read the next line from a file after doing ssh

Hi, I am trying to write a code, where it reads the jobnames from a file and checks for the logs in the server. If the log is not found in the first server, then it will ssh to the 2nd server and get the details from there. I will need to save the date in a variable. But the problem is that,... (0 Replies)
Discussion started by: ajayakunuri
0 Replies

6. Shell Programming and Scripting

While read line via ssh

Hi I have a question, Why below script does't work ?: #!/bin/bash cd /home/weblogic/ cp_date=`awk -F '/' '{print "/" $8 "/" $9 "/" $10}' file_ftp.txt` ssh node8@192.168.1.8 'while read line; do ls -l "$line"; done <<< "$cp_date"' >> lsl.txt When I am running this script localy... (2 Replies)
Discussion started by: primo102
2 Replies

7. Shell Programming and Scripting

Using read for input over ssh

Hi, I'm using read in a script to prompt and receive input. read -r -p "Do you also want to deploy folder? " response This works fine, however, if I remotely execute the same script via ssh, at this point in the code, I don't see the message at all, but it waits for input. I could echo... (1 Reply)
Discussion started by: say170
1 Replies

8. Shell Programming and Scripting

Read the USER Quota in SSH

How the User Quota query from an SSH access to Linux Shell. (5 Replies)
Discussion started by: Linuxmann
5 Replies

9. UNIX for Beginners Questions & Answers

Why this script is not working as 'expected' when doing ssh with while read ... really confused?

Hi, I have a script below that is running ssh <host> <command> on some servers. Below is more or less the script. I have to modify it somehow to get rid of the 'confidential' hostnames check_log.bash #!/bin/bash # myPID=$$ parse_log () { sub="parse_log" host=${1} ... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. Shell Programming and Scripting

Read several variables from command output via SSH

Hi Folks, I'm currently trying to read several values into different variables. Actually, what I'm doing works, but I get an error message. My attempts are: read strCPROC strIPROC strAPROC <<<$(ssh -n -T hscroot@$HMC "lshwres -r proc -m $strIDENT --level sys -F \"configurable_sys_proc_units... (11 Replies)
Discussion started by: NKaede
11 Replies
SSH-COPY-ID(1)						      General Commands Manual						    SSH-COPY-ID(1)

NAME
ssh-copy-id - install your public key in a remote machine's authorized_keys SYNOPSIS
ssh-copy-id [-i [identity_file]] [user@]machine DESCRIPTION
ssh-copy-id is a script that uses ssh to log into a remote machine and append the indicated identity file to that machine's ~/.ssh/autho- rized_keys file. If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if this: ssh-add -L provides any output, it uses that in preference to the identity file. If the -i option is used, or the ssh-add produced no output, then it uses the contents of the identity file. Once it has one or more fin- gerprints (by whatever means) it uses ssh to append them to ~/.ssh/authorized_keys on the remote machine (creating the file, and directory, if necessary.) NOTES
This program does not modify the permissions of any pre-existing files or directories. Therefore, if the remote sshd has StrictModes set in its configuration, then the user's home, ~/.ssh folder, and ~/.ssh/authorized_keys file may need to have group writability disabled manu- ally, e.g. via chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys on the remote machine. SEE ALSO
ssh(1), ssh-agent(1), sshd(8) OpenSSH 14 November 1999 SSH-COPY-ID(1)
All times are GMT -4. The time now is 04:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy