-4

I have one WHM panel data in /backup folder, I want to copy all data On remote server. Please provide me the script, how to use rsync command In script to sync data on a remote server and get the mail when the copy is Completed?

Thanks

  • SO is not the place to ask for people to write entire programs for you. You need to show a legitimate attempt to solve a specific problem you're having, e.g. you don't understand how something works, you can't get past an error message, etc. – Kimbluey Apr 06 '15 at 20:31
  • See [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) for more information – Kimbluey Apr 06 '15 at 20:32

1 Answers1

0

Here is the rsync shell script that I use. It is placed in a folder named /publish in my project.

The gist contains the rs_exclude.txt file the shell script mentions.

You might also be interested in using ssh keys so you don't have to type your password each time

# reverse the comments on the next two lines to do a dry run
#dryrun=--dry-run
dryrun=

c=--compress
exclude=--exclude-from=rs_exclude.txt
pg="--no-p --no-g"

#delete is dangerous - use caution.  I deleted 15 years worth of digital photos using rsync with delete turned on.
# reverse the comments on the next two lines to enable deleting
#delete=--delete
delete=

rsync_options=-Pav
rsync_local_path=../
rsync_server_string=user@example.com
rsync_server_path="/home/www.example.com"

# choose one.
#rsync $rsync_options $dryrun $delete $exclude $c $pg $rsync_local_path $rsync_server_string:$rsync_server_path

#how to specify an alternate port
#rsync -e "ssh -p 2220" $dryrun $delete $exclude $c $pg $rsync_local_path $rsync_server_string:$rsync_server_path

https://gist.github.com/treehousetim/2a7871f87fa53007f17e

Tim G
  • 1,812
  • 12
  • 25