Rsync in bash script doesn't work even after placing pub key in target server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Rsync in bash script doesn't work even after placing pub key in target server
# 1  
Old 01-20-2015
Rsync in bash script doesn't work even after placing pub key in target server

Hello Friends,

My bash script is like this

Code:
#!/bin/bash
# request Bourne shell as shell for job
#$ -S /bin/bash
# assume current working directory as paths
#$ -cwd
#$ -N rsync-copy
#
# print date and time
date

rsync -rltD --progress "ssh -i /home/myname/.ssh/id_rsa" /home/myname/Desktop/rsync-sample user@target.server.edu:~ 

# print date and time again
date

I did use key-gen to generate my public keys and had them in my target server's authorized keys. I can ssh without entering my password. But this particular when I submit it to the cluster using qsub, it just sits their hanging without doing anything.

Could you please comment?
# 2  
Old 01-20-2015
My suspicion is that the "--progress" (marked bold) option needs a terminal to work and "ssh" - depending on its configuration - might not necessarily provide one.

Quote:
Originally Posted by jacobs.smith
Code:
rsync -rltD --progress "ss[...]

You might try adding a "-t" to the ssh-options, which forces the allocation of a pseudo-tty. See "man ssh" for details about this.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 3  
Old 01-20-2015
Quote:
Originally Posted by bakunin
My suspicion is that the "--progress" (marked bold) option needs a terminal to work and "ssh" - depending on its configuration - might not necessarily provide one.



You might try adding a "-t" to the ssh-options, which forces the allocation of a pseudo-tty. See "man ssh" for details about this.

I hope this helps.

bakunin
Thanks Bakunin.

I did remove the --progress option and added the -t option to my ssh.

But still the job hangs with a status of t and no data is transferred across servers.

But just simply running the rsync command at the prompt works absolutely fine. But running in a bash script is much more easier for me because I have around 55TB of data that I need to copy.

Thank you for your time.
# 4  
Old 01-20-2015
Quote:
Originally Posted by jacobs.smith
But still the job hangs with a status of t and no data is transferred across servers.
I have no idea why this is so either, but you could perhaps execute proper debugging procedures: start by adding "set -xv" in your script like this:

Code:
#! /bin/bash

set -xv

[... rest of your script...]

set +xv

exit 0

which switches on a lot of diagnostic shell output (see the man page of "bash" for details). Capture this shell output into a file and analyse every line carefully.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 5  
Old 01-20-2015
Quote:
Originally Posted by bakunin
I have no idea why this is so either, but you could perhaps execute proper debugging procedures: start by adding "set -xv" in your script like this:

Code:
#! /bin/bash

set -xv

[... rest of your script...]

set +xv

exit 0

which switches on a lot of diagnostic shell output (see the man page of "bash" for details). Capture this shell output into a file and analyse every line carefully.

I hope this helps.

bakunin
I think since the job doesn't run and exit, no output file was generated.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Bash] passing variables to executable doesn't work

Bash version 4.4.20 / Ubuntu 16.0.4 Hello, I tried to write a script that gathers some data and passes them to an executable. The executed application answers with an error. The echo output in the script returns correct values. If I copy/paste the last echo command, it get's executed... (2 Replies)
Discussion started by: sushi2k7
2 Replies

2. UNIX for Beginners Questions & Answers

Bash diff date doesn't work

Hi everyone, I've an issue trying to soustracte two dates, e.g: d1=$(date -d "Nov 18, 2017" +%s) d2=$(date +%s) # Today we are 2017-11-16 echo "$(( (d1 - d2) / 86400 ))" Output: 1 I don't understand why it doesn't work. for me, it should give "18 - 16 = 2". Much appreciated... (1 Reply)
Discussion started by: Arnaudh78
1 Replies

3. Shell Programming and Scripting

Bash script: "mkdir -p" doesn't work with var(cat x)

Hello, :) I've an issue with the creation of a directory, All work without it :mad: So, below, my scripts with the debug output : #!/bin/bash # PATHS HOME_BACKUP="/home/backup" HOME_SCRIPT="/home/scripts/test/backup_server" TARGET="/var/www" # DATE DATE_Ymd=$(date +%Y-%m-%d) #... (1 Reply)
Discussion started by: Arnaudh78
1 Replies

4. Shell Programming and Scripting

pipe to grep doesn't work in bash script

Hi, I'm trying to write a script that checks gvfs to see if a mount exists so I can run it from network-manager's status hooks. I thought I'd pipe the output of gvfs-mount -l to grep for the particular mounts I care about. When I do this in a bash script: cmnd="gvfs-mount -l | grep -i... (4 Replies)
Discussion started by: kcstrom
4 Replies

5. AIX

AIX 5.3 on p275 - "|" key doesn't work (!)

More issues. The "|" key doesn't work at all, either in the text terminal or in mwm (which starts fine when I do "startx"). How am I supposed to troubleshoot without a "|" key? (2 Replies)
Discussion started by: smithfarm
2 Replies

6. Shell Programming and Scripting

Rename .pub and private key

I wish to generate a id_dsa.pub and id_dsa (Public and Private Key) in a common user group. I have checked the .ssh directory and i have already found id_dsa.pub and id_dsa existing. Is that OK if i create both the keys in my home direcotry, rename it to jjj.pub and jjj and move to Common user... (1 Reply)
Discussion started by: vasuarjula
1 Replies

7. UNIX for Dummies Questions & Answers

ssh pub key auth - can some please guide me idiot proof

hello. can somebody please idiot proff simple guide me how to set up ssh public key authenciation? i am stuck, i tried long and googled a lot but i cant get it. thanks in advance. (4 Replies)
Discussion started by: scarfake
4 Replies

8. UNIX for Advanced & Expert Users

FTP Server doesn't work??

I appreciate iif anybody can help me with this issue. I set up a Linux FTP server which is authorized user ID from AD. I do some configuration on vsftpd.conf file but it doesn't work out. I copy these configuration, can you help me to check again as when i connect through browser it always give me... (2 Replies)
Discussion started by: cthinh
2 Replies

9. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

10. UNIX for Dummies Questions & Answers

bash pattern matching echo *[! '/' ] doesn't work

without using ls, just using echo so purely pattern matching I can say echo */ <-- lists directories but how would I match files? surely something like *!/ or * but neither work ? it seems like there isn't much that I can put in but surely i should be able to put any ascii... (1 Reply)
Discussion started by: james hanley
1 Replies
Login or Register to Ask a Question