Skip to content
/ sync Public

Synchronizing specific directories and files using rsync + ssh without entering password.

Notifications You must be signed in to change notification settings

emusal/sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is the README file for emusal's Sync tool

Sync is to synchronize certain directories and files to or from remote.

Report bugs and issues at [email protected]

License: GPLv2

You can get the sources to the latest development version from the git 
repository:

git clone git://github.com/emusal/sync.git


Basic Usage:
============
$ ./sync
  or
$ ./sync bin  <-- 'bin' is rule name.

Files:
============
README          this file.
sync            executable main script.
synctest        sync test. This shell run 'rsync' with '--dry-run' option.
synclib.tcl     common library.

Variables:
==========
rsync_option    default 'rsync' option. this value is commonly applied to 
                all sync rules. For more detail information about this option, 
                please refer to 'man rsync'

hosts           remote host list to be synchroized

                Format:  

                {
                   { [user@][ip-address] [port] [password] }
                     ...
                }

                Example:

                set hosts = {
                    { [email protected] 22 app.123 }
                    { bin@localhost 22 bin.123 }
                }

named_hosts     special host list for named rule.

                Format:  

                {
                    { [name] {
                        { [user@][ip-address] [port] [password] }
                        ...
                    }}
                }

                Example: the files or directory, named 'file', is copied
                         to both, 'james@xxx' and 'admin@xxx" hosts.

                set named_hosts {
                    { file {
                        { [email protected] 22 james }
                        { [email protected] 22 admin }
                    }}
                }


Functions:
==========
sync_dir     synchronizing a local directory to remote

             Arguments:

             {name}            rule name. name is reusable between other rules
             {rsync-options}   additional 'rsync' options only for this rule
             {local-dir}       target directory (local)
             {remote-dir}      destination directory (remote)
             [excluding-patterns] ...
                               excludining pattern. format is exactly same with
                               --exclude option of 'rsync'

             Example:

             sync_dir "bin" "--copy-links" "env($HOME)/bin" "~/" "*.bkup"

sync_file    synchronizing local specific files to remote

             Arguments:

             {name}            rule name. name is reusable between other rules
             {rsync-options}   additional 'rsync' options only for this rule
             {local-dir}       target directory (local)
             {remote-dir}      destination directory (remote)
             [target-files ..] target file list to be synchronized. 

             Example: 'a.txt', 'b.txt' is copied into remote directory "~/."

             sync_file "file" "" "$env(HOME)/" "~/" "a.txt" "b.txt"

rsync_dir    reverse synchronizing a remote directory to local. 
             sub directories are recursively synced. and exclude pattern is 
             recursively applied for sub directories. 

             Arguments:

             {name}            rule name. name is reusable between other rules
             {rsync-options}   additional 'rsync' options only for this rule
             {local-dir}       destination directory (local)
             {remote-dir}      target directory (remote)
             [excluding-patterns ..]
                               excludining pattern. format is exactly same with
                               --exclude option of 'rsync'
             Example:

             rsync_dir "bin" "--copy-links" "env($HOME)/bin" "~/" "*.bkup"

rsync_file   reverse synchronizing remote specific files to local

             Arguments:

             {name}            rule name. name is reusable between other rules
             {rsync-options}   additional 'rsync' options only for this rule
             {local-dir}       destination directory (local)
             {remote-dir}      target directory (remote)
             [target-files ..] target file list to be synchronized. 

             Example: 'a.txt', 'b.txt' is copied into local directory "~/."

             rsync_file "file" "" "$env(HOME)/" "~/" "a.txt" "b.txt"

Files:
======
.include.sync 
.include.sync.{name}  

             including rule file for overall or specific named rule.
             it is same with '--include-from' option of 'rsync'. 
             '.include.sync.{name}' is applied for named rule. 
             if both files are exist, named file is prior to overall file.

             Example: only a.out file is copied
                    
             + bin
             + bin/a.out
             - *

.exclude.sync
.exclude.sync.{name}

             excluding rule file for overall or specific named rule.
             it is same with '--exclude-from' option of 'rsync'. 
             '.exclude.sync.{name}' is applied for named rule. 
             if both files are exist, named file is prior to overall file.

             Example: a.out, b.out files are excluded from sync list
                    
             a.out
             b.out

About

Synchronizing specific directories and files using rsync + ssh without entering password.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages