Sponsored Content
Top Forums Shell Programming and Scripting rsync script for synchronisation and backup Post 302484780 by onkeldave on Monday 3rd of January 2011 07:22:45 AM
Old 01-03-2011
rsync script for synchronisation and backup

hello,

i need to modified my synch/back scripts....

i want that this script only syncro folders in destinationfolder.

f.e. when in destination are two folders
1) admin
2) users

but in SOURCE are three:
1) admin
2) users
3) antivirus

the script should only increnmential sync the two from destinationfolder!


my script:
HTML Code:
#!/bin/sh

MAILADDR=david@xyz.de
HOSTNAME=mothership
BACKUPDIR=directory_you_want_to_backup
EXCLUDES=example_exclude_file
ARCHIVEROOT=directory_to_backup_to


# directory which holds our current datastore
CURRENT=main

# directory which we save incremental changes to
INCREMENTDIR=`date +%Y-%m-%d`

# options to pass to rsync
OPTIONS="--force --ignore-errors --delete --delete-excluded \
 --exclude-from=$EXCLUDES --backup --backup-dir=$ARCHIVEROOT/$INCREMENTDIR -av"

export PATH=$PATH:/bin:/usr/bin:/usr/local/bin

# make sure our backup tree exists
install -d $ARCHIVEROOT/$CURRENT

# our actual rsyncing function
do_rsync()
{
   rsync $OPTIONS $BACKUPDIR $ARCHIVEROOT/$CURRENT
}

# our post rsync accounting function
do_accounting()
{
   echo "Backup Accounting for Day $INCREMENTDIR on $HOSTNAME:">/tmp/rsync_script_tmpfile
   echo >> /tmp/rsync_script_tmpfile
   echo "################################################">>/tmp/rsync_script_tmpfile
   du -s $ARCHIVEROOT/* >> /tmp/rsync_script_tmpfile
   echo "Mail $MAILADDR -s $HOSTNAME Backup Report < /tmp/rsync_script_tmpfile"
   Mail $MAILADDR -s $HOSTNAME Backup Report < /tmp/rsync_script_tmpfile
   echo "rm /tmp/rsync_script_tmpfile"
   rm /tmp/rsync_script_tmpfile
}

# some error handling and/or run our backup and accounting
if [ -f $EXCLUDES ]; then
   if [ -d $BACKUPDIR ]; then
      # now the actual transfer
      do_rsync && do_accounting
   else
      echo "cant find $BACKUPDIR"; exit
   fi
   else
      echo "cant find $EXCLUDES"; exit
fi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sh : URGENT synchronisation insmod in script

Hello, By now in linux 2.4, I have a sh script wich start 2 modules as follow : /sbin/insmod module1.o /sbin/insmod module2.o I added an application in user space named "user_app" which communicate with module1 with a /proc. I now tape the commands myself during code execution on a... (1 Reply)
Discussion started by: crip01
1 Replies

2. Shell Programming and Scripting

lvm/tar/rsync backup script feedback/criticism

I have written a shell script to perform backups using tar, rsync and optionally utilise lvm snapshots. The script is not finished but is in a working state and comments/descriptions are poor. I would greatly appreciate any criticism and suggestions of the script to help improve my own learning... (0 Replies)
Discussion started by: jelloir
0 Replies

3. Shell Programming and Scripting

Rotating snapshot backup using rsync

I want to take daily backup(11pm) of /var/www to /mnt/bak excluding /var/www/videos and /var/www/old. HOW to implement a rotating snapshot method, so that i can have multiple(say 4) automatically rotating backups. (0 Replies)
Discussion started by: proactiveaditya
0 Replies

4. Shell Programming and Scripting

Rsync backup

How do i use Rsync yo pickup only new or modified files from source? I am using rsync -ravzpotu --delete-excluded but sometimes it goes thru all files again (5 Replies)
Discussion started by: sprool
5 Replies

5. UNIX Desktop Questions & Answers

Help with excluding .Trashes in an rsync backup

I'm using this script to backup an external hdd to another external hdd - rsync -aE --delete --exclude Volumes/Disk\ A/.Trashes "/Volumes/Disk A" "/Volumes/Disk A Backup"The source drive being "Disk A", and the drive I wish to backup to being "Disk A Backup". I'm constantly getting this error,... (4 Replies)
Discussion started by: Orbient
4 Replies

6. Shell Programming and Scripting

rsync backup and recovery options

Hi, Do we have any options in rsync to recover files from the backup? Please share your thoughts. Thanks in advance. (0 Replies)
Discussion started by: MVEERA
0 Replies

7. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

8. Shell Programming and Scripting

Rsync script and backup problems.

Hello everybody I'm triing since few days to do this. So sorry if my question looks stupide, but i've tried. I have to get picture from a folder (who is updated automaticly and with subfolder) with theirs extensions (i'm ok on that) and this files have to me copied in a folder where a website... (7 Replies)
Discussion started by: boytruc
7 Replies

9. Shell Programming and Scripting

Rsync better use for backup

Hello, I have a list of working directory in a remote computer acesssible through ssh and the same directory structure in my home directory of my laptop. I sometimes work on both my laptop and my this other computer. I usually use Rsync this way to synchronize files rsync... (5 Replies)
Discussion started by: ajayram
5 Replies

10. UNIX for Dummies Questions & Answers

Backup solution using rsync

Hello All, I am looking at a fast way to script some backups. I am looking at using rsync to do the leg work. I am having a hard time conceiving a script though. I have a tree with subfolders within subfolders. I was looking at the /xd option to parse the tree. Directory of k:\ ... (4 Replies)
Discussion started by: jvamos
4 Replies
INSTALLSIEVE(1) 					      General Commands Manual						   INSTALLSIEVE(1)

 *

NAME
installsieve - user utility for managing sieve scripts SYNOPSIS
installsieve DESCRIPTION
installsieve is a utility that allows users to manage their sieve scripts kept on the server. OPTIONS
-v <name> View script with the given name. The script if retrieved sucessfully is output to standard output. -l List all of the scripts currently on the server. If one of the scripts is active a arrow is printed indicating that it is the active script. -p <port> Port to connect to. If left off this defaults to "sieve" as defined in /etc/services. -i <file> Install a file onto the server. If a script with the same name already exists on the server it is overwritten. Upon sucessfully putting the script on the server the script is set active. If <file> has the extension .script it is chopped when put on the server since sieve names may not contain a '.'. -a <name> Set <name> as the active script. The list of available names can be obtained from the '-l' option.. -d <name> Delete the sieve script on the server with <name>. -m <mechanism> Force installsieve to use <mechanism> for authentication. If not specified the strongest authentication mechanism is chosen. -g <name> Get the sieve script with <name> and save it to disk with a ".script" extension. If a file with that name already exists it is overwritten. -u <user> Userid/Authname to use for authentication; by default, the current user. CMU
Project Cyrus INSTALLSIEVE(1)
All times are GMT -4. The time now is 10:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy