Sample Header Ad - 728x90

Bash script logging not working as expected with rsync jump server

0 votes
0 answers
242 views
I'm using a shell script below for doing some rsync on a remote host. By ssh to jumphost and from there ssh again and initiating the rsync as below. Here I need to capture the log start and end date. But somehow when i executed below script, as it prints both log at the same time. To be more precise, here the script spawns on ServerA , then jumping to ServerB, again it jumps to ServerC and then it hit the rsync command. Here I need to capture the start time and end time of rsync command on ServerA. But this end time which is not working as expected, once the script starts it keeps record the start and end time on logs.txt, but i can see the rsync process is still progressing. ~~~ date="date +%T-%D" i=folder echo "Log started at $date for $i" >> logs.txt ssh -T -i key user1@HOST1 "ssh -T user2@HOST2 > logs.txt fi ~~~ Here i would need this script to be active once the rsync process to finish on the remote host and then it proceed to the log ended part. I already tried the wait command, but this also not helped Any ideas appreciated
Asked by user183980 (153 rep)
Jun 20, 2022, 08:14 AM
Last activity: Jun 21, 2022, 12:47 PM