summaryrefslogtreecommitdiff
path: root/backup2webdav-pistar
diff options
context:
space:
mode:
authorJason D. McCormick <jason@mfamily.org>2023-02-24 14:42:22 -0500
committerJason D. McCormick <jason@mfamily.org>2023-02-24 14:42:22 -0500
commitf4f13e1081bba25e13cc209b378278a2d6a8b76a (patch)
treee5bc3b3ac9c05abbb6bdb5303a9ef37fbacda685 /backup2webdav-pistar
parent2594d09fb175bcdc916c87731bf98144be99159c (diff)
rename backup2webdav
Diffstat (limited to 'backup2webdav-pistar')
-rwxr-xr-xbackup2webdav-pistar48
1 files changed, 48 insertions, 0 deletions
diff --git a/backup2webdav-pistar b/backup2webdav-pistar
new file mode 100755
index 0000000..abac569
--- /dev/null
+++ b/backup2webdav-pistar
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+PATH=/usr/bin:/bin:/usr/sbin:/sbin
+
+FRVAL=0
+
+AUTH='pi-star:wtfwtfwtf!'
+
+for h in `cat /etc/backup-pistar | tr '\n' ' ' 2> /dev/null`
+do
+ hn=`echo $h | perl -pe 's/^([^\.]+)\..*$/$1/g'`
+
+ FT="/tmp/$hn.zip"
+
+ if [ -f $FT ]; then
+ echo "File $FT exists - incomplete run?"
+ exit 1
+ fi
+
+ F=`mktemp`
+
+ mv $F $FT
+
+ curl -s -d "action=download" -X POST --user $AUTH --output $FT http://$h/admin/config_backup.php
+ RVAL=$?
+
+ if [ $RVAL != 0 ]; then
+ echo "Error pulling down from $h"
+ rm $FT
+ FRVAL=1
+ else
+
+ rclone --bind=44.70.48.34 copy $FT nextcloud:/Backups/$hn/
+ RVAL=$?
+
+ if [ $RVAL != 0 ]; then
+ echo "Error rsyncing $FT to nextcloud"
+ FRVAL=1
+ fi
+
+ rm $FT
+ fi
+
+done
+
+exit $FRVAL
+
+