aboutsummaryrefslogtreecommitdiff
path: root/backupninja/rub
diff options
context:
space:
mode:
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2006-09-20 00:55:00 +0000
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2006-09-20 00:55:00 +0000
commite0bca862094f3781e18259a06abac570719874f3 (patch)
treef47b8b7b7490336915b742b539dbd045eb66d62d /backupninja/rub
parent8d01396f60619d873e11d6c59aeeafb974a204e4 (diff)
downloadslackbuilds-e0bca862094f3781e18259a06abac570719874f3.tar.gz
slackbuilds-e0bca862094f3781e18259a06abac570719874f3.tar.bz2
backupninja: merged pull on rub handler
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@240 370017ae-e619-0410-ac65-c121f96126d4
Diffstat (limited to 'backupninja/rub')
-rwxr-xr-xbackupninja/rub28
1 files changed, 25 insertions, 3 deletions
diff --git a/backupninja/rub b/backupninja/rub
index cee94821..ae6373a9 100755
--- a/backupninja/rub
+++ b/backupninja/rub
@@ -22,6 +22,9 @@
# [source]
# include = include folder on backup
# exclude = exclude folder on backup
+# type = local or remote
+# ssh = ssh command line (remote only)
+# rsync = rsync command line
#
# [services]
# initscripts = absolute path where scripts are located
@@ -40,6 +43,11 @@ getconf days
getconf lockfile
setsection source
+getconf type local
+getconf rsync rsync -av --delete
+getconf ssh ssh
+getconf user
+getconf host
getconf include
getconf exclude
@@ -126,11 +134,25 @@ for SECTION in $include; do
mkdir -p $backupdir/$SECTION/$section.0
fi
- info "Rotating $backupdir/$SECTION/$SECTION..."
- echo "Rotating $backupdir/$SECTION/$SECTION..." >> $log
+ info "Rotating $backupdir/$SECTION/$section..."
+ echo "Rotating $backupdir/$SECTION/$section..." >> $log
rotate $backupdir/$SECTION/$section $keep
info "Syncing $SECTION on $backupdir/$SECTION/$section.0..."
- rsync -av --delete $EXCLUDES /$SECTION/ $backupdir/$SECTION/$section.0/ >> $log
+
+ if [ "$type" == "local" ] then
+ $rsync $EXCLUDES /$SECTION/ $backupdir/$SECTION/$section.0/ >> $log
+ elif [ "$type" == "remote" ]; then
+ if [ -z "$user" ] || [ -z "$host" ]; then
+ error "Config file error: either user or host was not specified"
+ exit 1
+ else
+ $rsync "$ssh" $user@$host:/$SECTION/ $backupdir/$SECTION/$section.0 >> $log
+ fi
+ else
+ error "Invalid source type $type"
+ exit 1
+ fi
+
touch $backupdir/$SECTION/$section.0
done