From 892895e8023ae89e7e9991fd511a138d940d9e98 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 8 May 2016 18:11:07 +0200 Subject: [PATCH] Added rsyc script, working with the same file list ... dry run by default --- backup and restore/backup.sh | 8 ----- backup and restore/filelist.txt | 61 ++++++++++++++++++--------------- backup and restore/sync.sh | 23 +++++++++++++ 3 files changed, 56 insertions(+), 36 deletions(-) create mode 100644 backup and restore/sync.sh diff --git a/backup and restore/backup.sh b/backup and restore/backup.sh index 07490d9..1e47470 100644 --- a/backup and restore/backup.sh +++ b/backup and restore/backup.sh @@ -14,13 +14,6 @@ HOST=localhost mkdir -p $COPY_TO -function crontab_backup () -{ - echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mCrontab backup" - crontab -l > $COPY_TO/crontab-root.txt &> /dev/null -} - - function database_backup () { if which mysql >/dev/null; then @@ -97,7 +90,6 @@ function pkglist_backup () # main app -crontab_backup database_backup web_backup conf_backup diff --git a/backup and restore/filelist.txt b/backup and restore/filelist.txt index 18c87ff..7fd7a06 100644 --- a/backup and restore/filelist.txt +++ b/backup and restore/filelist.txt @@ -1,37 +1,42 @@ -/etc/dovecot/dovecot.conf -/etc/dovecot/dovecot.pem -/etc/dovecot/private/dovecot.pem -/etc/cups -/etc/fstab -/etc/transmission-daemon/settings.json -/etc/scanbuttond -/etc/apache2 +/etc/dovecot +#/etc/cups +#/etc/fstab +#/etc/transmission-daemon/settings.json +#/etc/scanbuttond +#/etc/apache2 /etc/memcached.conf -/etc/logrotate.conf +#/etc/logrotate.conf +/etc/mail /etc/mailname /etc/nginx -/etc/dbconfig-common -/etc/init.d/scanbuttond +#/etc/init.d/scanbuttond /etc/postfix -/etc/rc.local +/etc/passwd +#/etc/rc.local +/etc/php5 /etc/getmail -/usr/local/bin/.sync +/etc/fail2ban +/etc/shadow +/etc/group +/etc/gshadow +#/usr/local/bin/.sync /etc/mysql/my.cnf /etc/default/stunnel4 -/usr/local/vpnserver/vpn_server.config -/usr/bin/tv_grab_file -/home/hts/.hts/tvheadend -/etc/samba/smb.conf -/etc/modules -/etc/network/interfaces -/etc/hostapd.conf -/etc/hostapd-rt.conf -/etc/usbsrvd.conf +#/usr/local/vpnserver/vpn_server.config +#/usr/bin/tv_grab_file +#/home/hts/.hts/tvheadend +#/etc/samba/smb.conf +#/etc/modules +#/etc/network/interfaces +#/etc/hostapd.conf +#/etc/hostapd-rt.conf +#/etc/usbsrvd.conf /etc/default/stunnel4 /etc/stunnel -/etc/logrotate.d -/usr/local/ispconfig/interface/ssl/startssl.chain.class1.server.crt -/usr/local/ispconfig/interface/ssl/startssl.sub.class1.server.ca.crt -/root/removecomptorrent.sh -/root/.ssh -/root/.gnupg \ No newline at end of file +#/etc/logrotate.d +/usr/local/ispconfig/interface/ssl +/usr/local/bin/removecomptorrent.sh +/var/spool/cron/crontabs +#/etc/crontab +/var/vmail +/var/www \ No newline at end of file diff --git a/backup and restore/sync.sh b/backup and restore/sync.sh new file mode 100644 index 0000000..beb0483 --- /dev/null +++ b/backup and restore/sync.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +REMOTE= + +function sync_backup () +{ + echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mSync over trusted ssh net" + + filename=filelist.txt + IFS=$'\n' + for next in `cat $filename` + do + if [[ $next != \#* ]]; then + echo $next + rsync --dry-run -az --progress $REMOTE:$next $next + [[ ! $? -eq 0 ]] && read + fi + done +} + + +sync_backup +