[backup] Add backup.sh
Simple script to transfer a directory with rsync, with a few options.
This commit is contained in:
parent
c227b574f4
commit
4f9bb9d7fd
|
@ -1,3 +1,15 @@
|
|||
# backup.sh #
|
||||
|
||||
backup.sh is a simple script that transfers a single directory (your
|
||||
home directory, by default) to a remote host, using rsync. You can
|
||||
specify exclude patterns in a file (~/.backup-excludes by default).
|
||||
The transfer will be reattempted until it succeed.
|
||||
|
||||
Edit the script to configure the protocol, host, directories, etc.
|
||||
|
||||
|
||||
# backup_sites_mysql.sh #
|
||||
|
||||
The script backup_sites_mysql.sh is designed to save websites data files
|
||||
and the associated MySQL databases.
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# backup.sh, Copyright © 2011 Matteo Cypriani <mcy@lm7.fr>
|
||||
#
|
||||
# This program is free software. It comes without any warranty, to
|
||||
# the extent permitted by applicable law. You can redistribute it
|
||||
# and/or modify it under the terms of the Do What The Fuck You Want
|
||||
# To Public License, Version 2, as published by Sam Hocevar. See
|
||||
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
#
|
||||
# Transfers a single directory to a remote host using rsync. The
|
||||
# transfer is retried until it succeeds.
|
||||
|
||||
# Any of the protocol supported by rsync, with the "://" (blank to use
|
||||
# SSH):
|
||||
PROTO=rsync://
|
||||
# Remote backup host:
|
||||
HOST=vicious
|
||||
# Destination of the backup on the remote host:
|
||||
REMOTE_DIR=/backup
|
||||
|
||||
# Local directory to backup:
|
||||
LOCAL_DIR="$HOME"
|
||||
# File where the excludes patterns are stored (one per line):
|
||||
EXCLUDES="$HOME/.backup-excludes"
|
||||
# Blank to keep the locally deleted files on the remote host (you can
|
||||
# also set to --delete-after or --delete-before):
|
||||
DELETE="--delete"
|
||||
|
||||
false
|
||||
until [ $? -eq 0 ] ; do
|
||||
rsync -av ${DELETE} --exclude-from="$EXCLUDES" \
|
||||
"$LOCAL_DIR" ${PROTO}://${HOST}:"$REMOTE_DIR"
|
||||
done
|
Loading…
Reference in New Issue