Need help to understand this small script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help to understand this small script
# 1  
Old 04-23-2014
Need help to understand this small script

Hi Guys,

I need to understand below scipt:-

Code:
-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.
# 2  
Old 04-23-2014
Hi Manali

Looks like there shell script
Code:
rsync

under directory
Code:
/usr/local/bin/

. and
Code:
-a -pdt -v --stats

are parameters to shell script
Code:
rsync

if possible please go through shell script
Code:
rsync

This User Gave Thanks to Makarand Dodmis For This Post:
# 3  
Old 04-23-2014
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. :-)

Thanks

Last edited by DukeNuke2; 04-26-2014 at 04:45 AM..
# 4  
Old 04-23-2014
ok Smilie will avoid henceforth
This User Gave Thanks to Makarand Dodmis For This Post:
# 5  
Old 04-23-2014
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 .https://www.unix.com/man-page/linux/1/rsync/
https://www.unix.com/man-page/linux/1/batch/
This User Gave Thanks to chacko193 For This Post:
# 6  
Old 04-24-2014
Quote:
Originally Posted by chacko193
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 .https://www.unix.com/man-page/linux/1/rsync/
https://www.unix.com/man-page/linux/1/batch/
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!
# 7  
Old 04-25-2014
Yup, basically thats what it does.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help me understand this script

#!/bin/awk -f BEGIN {i=1;file="modified.txt"} { if ($0 !~ /^DS:/) {print $0 >> file} else { if ($0 ~ /^DS:/) {print "DS: ",i >> file;if (i==8) {i=1} else {i++}}; } } END {gzip file} Can someone explain to me how this above script works, I got it from a friend but not able... (3 Replies)
Discussion started by: Kamesh G
3 Replies

2. Shell Programming and Scripting

Need help to understand the below shell script

Please help me to understand the below 3 lines of code.execute shell in jenkins 1)APP_IP=$( docker inspect --format '{{ .NetworkSettings.Networks.'"$DOCKER_NETWORK_NAME"'.IPAddress }}' ${PROJECT_NAME_KEY}"-CI" ) 2)HOST_WORKSPACE=$(echo ${WORKSPACE} | sed... (1 Reply)
Discussion started by: naresh85
1 Replies

3. Shell Programming and Scripting

Can't understand script output

New to korn shel1 and having an issue. The following is suppose to read the parameter values from files in a source directory and then pass them on to a log file in a different directory, The ArchiveTracker scripts is suppose to call the parameterreader script to exact the parameter values and... (3 Replies)
Discussion started by: bayouprophet
3 Replies

4. Shell Programming and Scripting

Help to understand a script

Hello world! Can someone please explain me how this code works? I'ts supposed to find words in a dictionary and show the anagrams of the words. { part = word2key($1) data = $1 } function word2key(word, a, i, x, result) { x = split(word, a, "") asort(a) ... (1 Reply)
Discussion started by: jose2802
1 Replies

5. Shell Programming and Scripting

Need small help to understand algorithm

Hi! all I am reading one research paper in that I found one peak detection algorithm, I am just trying to understand how it works please anyone help me to convert algorithm to awk as I am not able to understand, here I am attaching that paper also, please help me to understand this logic (Page... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

6. Shell Programming and Scripting

Help me understand the Perl script..

#!/usr/bin/perl use strict; use warnings; print "Demo of array slicing \n"; my @abc="a b c d e f g h i j k l m n o p q r s t u v w x y z"; my @a=@abc; my @random=@abc; my @comp=@abc; my @comp1=(@abc,"Hello",@abc); print "abc is @abc \n"; print "a is @a \n"; print "random is @random \n";... (1 Reply)
Discussion started by: dnam9917
1 Replies

7. Shell Programming and Scripting

Help to understand the script

Hi All; Is there anybody can explain this script please? trap 'C_logmsg "F" "CNTL/c OS signal trapped, Script ${G_SCRIPTNAME] terminated"; exit 1' 2 trap 'C_logmsg "F" "Kill Job Event sent from the Console, Script ${G_SCRIPTNAME] terminated"; exit 1' 15 (3 Replies)
Discussion started by: thankbe
3 Replies

8. Shell Programming and Scripting

Can't understand the script

I am relatively new to Shell Scripting. I can't understand the following two scripts. Can someone please spare a minute to explain? 1) content s of file a are (021) 654-1234 sed 's/(//g;s/)//g;s/ /-/g' a 021-654-1234 2)cut -d: -f1,3,7 /etc/passwd |sort -t: +1n gives error (3 Replies)
Discussion started by: shahdharmit
3 Replies

9. Shell Programming and Scripting

help wanted to understand MQ script

hi , i am writing a script to copy the MQ messages from onw queue to another. The following i got from one site, but i di not understand , can anyone explain. /root/scripts/sap/q -m$Q_MANAGER -i$Q_NAME_SRC_1 -F/logs/mq/MQ_COPYdump_$Q_NAME_SRC_1.$$ /root/scripts/sap/q -m$Q_MANAGER... (0 Replies)
Discussion started by: Satyak
0 Replies
Login or Register to Ask a Question