diff --git a/Services/backup-contabo-db.service b/Services/backup-contabo-db.service deleted file mode 100755 index 83f2e7d..0000000 --- a/Services/backup-contabo-db.service +++ /dev/null @@ -1,5 +0,0 @@ -[Unit] -Description=Backup contabo db daily - -[Service] -ExecStart=/home/bruno/Backups/Contabo/backup-db.sh diff --git a/Services/backup-contabo-db.timer b/Services/backup-contabo-db.timer deleted file mode 100755 index c56753a..0000000 --- a/Services/backup-contabo-db.timer +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Backup contabo db daily - -[Timer] -Persistent=true -OnCalendar=*-*-* 10:00:00 -WakeSystem=true - -[Install] -WantedBy=timers.target diff --git a/Services/backup-contabo-files.service b/Services/backup-contabo-files.service deleted file mode 100755 index 01c813e..0000000 --- a/Services/backup-contabo-files.service +++ /dev/null @@ -1,5 +0,0 @@ -[Unit] -Description=Backup contabo files once per week - -[Service] -ExecStart=/home/bruno/Backups/Contabo/backup-files.sh diff --git a/Services/backup-contabo.service b/Services/backup-contabo.service new file mode 100755 index 0000000..ede60f0 --- /dev/null +++ b/Services/backup-contabo.service @@ -0,0 +1,5 @@ +[Unit] +Description=Backup contabo daily + +[Service] +ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh diff --git a/Services/backup-contabo.sh b/Services/backup-contabo.sh new file mode 100755 index 0000000..6cffdc0 --- /dev/null +++ b/Services/backup-contabo.sh @@ -0,0 +1,10 @@ +#! /bin/bash +sleep 60 +/bin/rsync -a -e "ssh -i /home/bruno/.ssh/id_rsa_backup" mybackup@167.86.78.36:/home/bruno/backups/* /home/bruno/Backups/Contabo/ + +# Delete old backups +find /home/bruno/Backups/Contabo/db -type f -name "*.sql.gz" -mtime +15 -delete +find /home/bruno/Backups/Contabo/files -type f -name "*.*" -mtime +35 -delete +find /home/bruno/Backups/Contabo/vmail -type f -name "*.*" -mtime +20 -delete + +find /home/bruno/Backups/Contabo/ -type f -name "*.*" -mtime +120 -delete diff --git a/Services/backup-contabo-files.timer b/Services/backup-contabo.timer similarity index 63% rename from Services/backup-contabo-files.timer rename to Services/backup-contabo.timer index c8025f3..1abd42f 100755 --- a/Services/backup-contabo-files.timer +++ b/Services/backup-contabo.timer @@ -1,9 +1,9 @@ [Unit] -Description=Backup contabo files once per week +Description=Backup contabo daily [Timer] Persistent=true -OnCalendar=*-*-* 10:03:00 +OnCalendar=*-*-* 10:15:00 WakeSystem=true #DayOfWeek Year-Month-Day Hour:Minute:Second diff --git a/Services/backup-db.sh b/Services/backup-db.sh deleted file mode 100755 index 167ee56..0000000 --- a/Services/backup-db.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/bash -sleep 50 -sshKey=$(<.sshKey) -serverBackupPath=$(<.serverBackupPath) -localPath=$(<.localBackupPath) - -/bin/rsync -r -e "ssh -i $sshKey" "$serverBackupPath/db/*" "$localPath/db/" - -# Delete files older than 15 days -find "$localPath/db" -type f -name "*.sql.gz" -mtime +15 -delete diff --git a/Services/backup-files.sh b/Services/backup-files.sh deleted file mode 100755 index 30e2f17..0000000 --- a/Services/backup-files.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/bash -sleep 60 -sshKey=$(<.sshKey) -serverBackupPath=$(<.serverBackupPath) -localPath=$(<.localBackupPath) - -/bin/rsync -r -e "ssh -i $sshKey" "$serverBackupPath/files/*" "$localPath/files/" - -# Delete files older than 30 days -find "$localPath/files" -type f -name "*.*" -mtime +30 -delete