From c3ce5cced24023d8591f213e4b710edcd5d93e8e Mon Sep 17 00:00:00 2001 From: Ralf Kirchner Date: Fri, 8 Apr 2016 22:25:09 +0200 Subject: [PATCH] Initial Upload Backup Script Datei. --- oc2fb.sh | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 oc2fb.sh diff --git a/oc2fb.sh b/oc2fb.sh new file mode 100644 index 0000000..0655944 --- /dev/null +++ b/oc2fb.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# *************************************************************************** +# * Copyright (C) 2016 by Ralf Kirchner * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU General Public License as published by * +# * the Free Software Foundation; either version 2 of the License, or * +# * (at your option) any later version. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU General Public License for more details. * +# * * +# * You should have received a copy of the GNU General Public License * +# * along with this program; if not, write to the * +# * Free Software Foundation, Inc., * +# * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +# *************************************************************************** + +### FTP connection user name +FUSER="" + +### FTP connection password +FPASS="" + +### FTP server name +FHOST="" + +### OwnCloud data dir +DATA="" + + + +########## do not change bellow ############ + +# test required apps installed +for i in lftp getfacl +do + if ! [ $(which $i) ]; then + echo "$i is not installed." >&2 + exit 1 + fi +done + +# check old logfile exist then delete +if [ -e "/tmp/lftp.log" ] +then + rm /tmp/lftp.log +fi + + + +for i in $DATA +do + echo "###########################################################" >> /tmp/lftp.log + echo "# Backup Start fuer: $DATA Verzeichnis..." >> /tmp/lftp.log + echo "###########################################################" >> /tmp/lftp.log + + # write directory owner and rights to file + echo "Erstelle Rechte Liste: $i/dir-rights.list" >> /tmp/lftp.log + getfacl --recursive $i > $i/dir-rights.list + echo "Rechte Liste erstellt..." >> /tmp/lftp.log + + # write data to FTP dir + lftp <