Solved

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

Posted on 2013-05-13
5
239 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
5 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 125 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 125 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 29

Assisted Solution

by:serialband
serialband earned 250 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 29

Assisted Solution

by:serialband
serialband earned 250 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

789 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