?
Solved

can anyone explain what this command for, especially the part between " ".

Posted on 2013-05-13
5
Medium Priority
?
244 Views
Last Modified: 2013-05-31
rsync -ave "ssh -i /home/forms/.ssh/phobosRSA" --delete forms@phobos:/u4/minkaPics/ /minkaPics
0
Comment
Question by:Jason Yu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39163273
man rsync
DESCRIPTION
       rsync is a program that behaves in much the same way that rcp does, but
       has many more options and uses  the  rsync  remote-update  protocol  to
       greatly  speed  up  file  transfers  when the destination file is being
       updated.
        -v, --verbose               increase verbosity
        -a, --archive               archive mode; same as -rlptgoD (no -H)
        -e, --rsh=COMMAND           specify the remote shell to use

man ssh
DESCRIPTION
     ssh (SSH client) is a program for logging into a remote machine and for
     executing commands on a remote machine.  It is intended to replace rlogin
     and rsh, and provide secure encrypted communications between two
     untrusted hosts over an insecure network.  X11 connections and arbitrary
     TCP ports can also be forwarded over the secure channel.
     -i identity_file
             Selects a file from which the identity (private key) for RSA or
             DSA authentication is read.  The default is ~/.ssh/identity for
             protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for pro-
             tocol version 2.  Identity files may also be specified on a per-
             host basis in the configuration file.  It is possible to have
             multiple -i options (and multiple identities specified in config-
             uration files).
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 500 total points
ID: 39163320
Compare the directories and files on phobos and delete them on destination.

--delete                delete extraneous files from dest dirs

Open in new window

0
 
LVL 30

Assisted Solution

by:serialband
serialband earned 1000 total points
ID: 39166480
In more layman's terms, rsync is the tool used to copy or synchronize files.  It's basically mirroring the minkaPics folders from a system named phobos to the local system using the ssh key in the forms account.

The -e "ssh -i /home/forms/.ssh/phobosRSA" portion of the rsync command tells it to load the current (forms) user's ssh key, which I assume is passwordless, so that it doesn't prompt for a password.  Otherwise, a shorter command could be used with an rsync server that's been set up.

rsync -av --delete forms@phobos:/u4/minkaPics/ /minkaPics

You can also use the -e option to force it to use ssh with options to change ports, or use another ssh account.

The --delete option forces files to be deleted on the destination if it no longer exists at the source.  This allows rsync to basically mirror or duplicate the folder.
0
 

Author Comment

by:Jason Yu
ID: 39175827
hi, all, thanks for your replies.

I tried to fine tune this script and run it for two folders under /minkaPics.

However, after check the folders' sizes, they showed different size on the original server and destination server. Could you guys help me take a look?

Thank you.


----------------------------------


## This is the start of the script. It will mount the nfs drive then start the conversion.
mountIt
if [ `echo $?` != "1" ]; then
conversion
echo -e "To:IT<$blokes>
From: $host<$shost@minkagroup.net>
Subject: Minka pic script completed
Images have been converted successfully" | /usr/sbin/sendmail $blokes
umount $mnt
fi

elif [ `hostname` = "deimos.minkagroup.net" ]; then

#This script syncs the phobos:/u4/minkaPics folder with the local /u1/minkaPics folder.
#If any files are deleted off of phobos then they will also be removed from the local system.

rsync -ave "ssh -i /home/forms/.ssh/phobosRSA" --delete forms@phobos:/u4/minkaPics/medium /minkaPics/medium
rsync -ave "ssh -i /home/forms/.ssh/phobosRSA" --delete forms@phobos:/u4/minkaPics/small /minkaPics/small
if [ `echo $?` != "0" ]; then
echo -e "To:IT<$blokes>
From: $host<$shost@minkagroup.net>
Subject: Minka Pic sync on $host Failed!
Minka Pic sync between Deimos and Phobos failed" | /usr/sbin/sendmail $blokes
fi
size-is-different.jpg
0
 
LVL 30

Assisted Solution

by:serialband
serialband earned 1000 total points
ID: 39176044
Have you tried to just run the rsync commands manually?  Cut and paste the rsync commands from the script and run it at the terminal to see what happens
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question