Need help to understand this small script

Hi Guys,

I need to understand below scipt:-

-bash-3.00$ cat rsync-copy.ksh
#!/usr/5bin/ksh
batch <<%EOF%
        echo "/usr/local/bin/rsync  --rsync-path=/usr/local/bin/rsync -a --stats /usr/openv/ /OpenvBCK" > openv.LOG
        # CG /usr/local/bin/rsync  --rsync-path=/usr/local/bin/rsync -a -pdt -v --stats /usr/openv/ /OpenvBCK >> openv.LOG
        /usr/local/bin/rsync  --rsync-path=/usr/local/bin/rsync -a -pdt -v --stats /users/peter /OpenvBCK >> openv.LOG
        echo DONE >> openv.LOG
%EOF%
-bash-3.00$

The only thing I know is that it is copying contect of "/usr/openv" to "/OpencBCK"

But dont know why '-pdt" is wirrten there?
Why stats is mentioned there?
Why "/users/peter" the user home directory mentioned there?

Please advise.

Thanks,
Manali.

Hi Manali

Looks like there shell script

rsync

under directory

/usr/local/bin/

. and

-a -pdt -v --stats 

are parameters to shell script

rsync

if possible please go through shell script

rsync
1 Like

hey rsync looks like system command not script which are created by user.

Please avoid using too much of code tag it is difficult to understand your words. :slight_smile:

Thanks

ok :slight_smile: will avoid henceforth

1 Like

What it does is run the rsync command and save it output to the log file. It also saves the exact command that is executed, i.e., the arguments that is passed to the rsync and "Done" when the command has finished execution.

The %EOF% is just something that is used to give the input to the batch . Look here for more info: Here Documents

Go through the man pages for both the commands .rsync(1) [linux man page]
batch(1) [linux man page]

1 Like

Ok, So let me just confirm, all it does is copy contents of /usr/openv to /OpenvBCK right?

Because this is what I really want to happen through this script.

Thanks a lot!

Yup, basically thats what it does.