2013-07-15 22:10:23 +00:00
#!/bin/bash
2013-07-20 11:43:11 +00:00
###### Osync - Rsync based two way sync engine with fault tolerance
2013-07-16 11:55:15 +00:00
###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr)
2013-09-11 14:22:49 +00:00
#### Config file rev 1109201302
2013-07-15 22:10:23 +00:00
2013-07-22 09:34:58 +00:00
## Sync job identification, any string you want, no spaces
2013-07-15 22:10:23 +00:00
SYNC_ID="sync_test"
2013-08-24 17:51:39 +00:00
## Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log
2013-08-18 11:15:40 +00:00
LOGFILE=""
2013-07-15 22:10:23 +00:00
## Directories to synchronize
2013-08-04 13:20:26 +00:00
MASTER_SYNC_DIR="/home/git/osync/test/dir1"
SLAVE_SYNC_DIR="/home/git/osync/test/dir2"
2013-07-15 22:10:23 +00:00
2013-07-22 09:34:58 +00:00
## Create sync directories if they do not exist
2013-08-04 13:20:26 +00:00
CREATE_DIRS=no
2013-07-21 19:40:55 +00:00
2013-07-19 16:15:25 +00:00
## List of directories to exclude in sync on both sides (rsync patterns, wildcards work). Must be relative paths. List is separated by PATH SEPARATOR CHAR defined below (semicolon by default).
2013-07-24 19:03:58 +00:00
RSYNC_EXCLUDE_PATTERN="tmp;archives"
2013-07-19 16:15:25 +00:00
## You might change this separator case in the unholy case that your filename may contain semicolons. Change it then to whatever unholy char you want.
PATH_SEPARATOR_CHAR=";"
2013-07-15 22:10:23 +00:00
## Generate an alert if master or slave have lass space than given value in KB.
2013-07-22 19:14:57 +00:00
MINIMUM_SPACE=10240
2013-07-15 22:10:23 +00:00
2013-08-04 13:20:26 +00:00
## Bandwidth limit Kbytes / second. Leave 0 to disable limitation
BANDWIDTH=0
2013-07-15 22:10:23 +00:00
## If enabled, synchronization will be processed with sudo command. See documentation
2013-07-24 19:03:58 +00:00
SUDO_EXEC=no
## Paranoia option. Don't change this unless you read the documentation and know what you are doing.
2013-07-15 22:10:23 +00:00
RSYNC_EXECUTABLE=rsync
##Remote options (will sync slave through ssh tunnel, needs RSA key. See documentation for remote sync.
REMOTE_SYNC=no
SSH_RSA_PRIVATE_KEY=~/.ssh/id_rsa
2013-08-24 17:51:39 +00:00
REMOTE_USER=syncuser
2013-07-24 19:03:58 +00:00
REMOTE_HOST=your-remote-host.tld
REMOTE_PORT=22
2013-07-22 09:34:58 +00:00
## ssh compression should be used unless your remote connection is good enough (LAN)
2013-07-15 22:10:23 +00:00
SSH_COMPRESSION=yes
2013-08-24 17:51:39 +00:00
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
2013-07-20 11:43:11 +00:00
REMOTE_HOST_PING=no
2013-08-24 17:51:39 +00:00
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.fr"
2013-07-15 22:10:23 +00:00
2013-07-22 09:34:58 +00:00
## Preserve ACLS. Make sure target FS can hold ACLs or you'll get loads of errors.
2013-07-24 19:03:58 +00:00
PRESERVE_ACL=no
2013-07-22 09:34:58 +00:00
## Preserve Xattr
2013-07-24 19:03:58 +00:00
PRESERVE_XATTR=no
2013-07-22 09:34:58 +00:00
## Let RSYNC compress file transfers. Do not use if you already enabled SSH compression.
2013-07-15 22:10:23 +00:00
RSYNC_COMPRESS=yes
2013-07-24 19:03:58 +00:00
## Maximum execution time (in seconds) for sync process. Soft exec time only generates warning. Hard exec time will generate warning and stop sync process.
2013-08-04 13:20:26 +00:00
SOFT_MAX_EXEC_TIME=7200
HARD_MAX_EXEC_TIME=10600
2013-07-15 22:10:23 +00:00
2013-07-22 09:34:58 +00:00
## If the same file exists on both sides, newer version will be used. If both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner
2013-07-16 11:55:15 +00:00
CONFLICT_PREVALANCE=master
2013-07-22 09:34:58 +00:00
## Keep a backup of a file if gets updated from remote side
2013-07-16 11:55:15 +00:00
CONFLICT_BACKUP=yes
2013-07-22 09:34:58 +00:00
## Keep multiple backups of a file if it gets updated from remote side. This can be very space consuming
2013-07-24 19:03:58 +00:00
CONFLICT_BACKUP_MULTIPLE=no
2013-07-22 09:34:58 +00:00
## Number of days to keep backups
CONFLICT_BACKUP_DAYS=30
2013-07-15 22:10:23 +00:00
2013-07-22 09:34:58 +00:00
## On deletition propagation to sync partner, keep a backup of deleted files on sync partner
2013-07-15 22:10:23 +00:00
SOFT_DELETE=yes
2013-07-22 09:34:58 +00:00
## Number of days to keep deleted files
2013-07-15 22:10:23 +00:00
SOFT_DELETE_DAYS=30
2013-07-24 19:03:58 +00:00
## Try to resume an aborted sync task
2013-07-22 09:34:58 +00:00
RESUME_SYNC=yes
2013-07-24 19:03:58 +00:00
## Number maximum resume tries before initating a new sync
2013-07-19 10:49:40 +00:00
RESUME_TRY=2
2013-07-24 19:03:58 +00:00
## When a pidlock exists on slave that does not correspond to master's sync-id, force pidlock removal. Be carefull with this option if you have multiple masters.
2013-07-22 09:34:58 +00:00
FORCE_STRANGER_LOCK_RESUME=no
2013-07-19 10:49:40 +00:00
2013-07-22 09:34:58 +00:00
## List of alert mails separated by spaces
2013-07-24 19:03:58 +00:00
DESTINATION_MAILS="your@alert.tld"
2013-07-15 22:10:23 +00:00
2013-07-22 09:34:58 +00:00
## Run local commands before and after sync task
2013-07-15 22:10:23 +00:00
LOCAL_RUN_BEFORE_CMD=""
LOCAL_RUN_AFTER_CMD=""
2013-07-22 09:34:58 +00:00
## Run commands on remote slave befre and after sync task
2013-07-24 19:03:58 +00:00
REMOTE_RUN_BEFORE_CMD=""
REMOTE_RUN_AFTER_CMD=""
2013-07-15 22:10:23 +00:00
2013-07-24 19:03:58 +00:00
## Maximum execution time (in seconds) for commands before sync task. Commands get killed if not finished after MAX_EXC_TIME. Set this to 0 to disable killing.
2013-07-15 22:10:23 +00:00
MAX_EXEC_TIME_PER_CMD_BEFORE=0
2013-07-24 19:03:58 +00:00
## Maximum execution time (in seconds) for commands after sync task. Commands get killed if not finished after MAX_EXEC_TIME. Set this to 0 to disable killing command.
2013-07-15 22:10:23 +00:00
MAX_EXEC_TIME_PER_CMD_AFTER=0
2013-09-11 14:22:49 +00:00
## Stops osync execution if one of the above commands fail
STOP_ON_CMD_ERROR=yes