mirror of
https://github.com/brunofontes/linuxShortcuts.git
synced 2024-11-23 22:30:51 +00:00
Organizing VPS backup
This commit is contained in:
parent
8f16048878
commit
6093a485a2
@ -1,5 +0,0 @@
|
||||
[Unit]
|
||||
Description=Backup contabo db daily
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/bruno/Backups/Contabo/backup-db.sh
|
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Backup contabo db daily
|
||||
|
||||
[Timer]
|
||||
Persistent=true
|
||||
OnCalendar=*-*-* 10:00:00
|
||||
WakeSystem=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -1,5 +0,0 @@
|
||||
[Unit]
|
||||
Description=Backup contabo files once per week
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/bruno/Backups/Contabo/backup-files.sh
|
5
Services/backup-contabo.service
Executable file
5
Services/backup-contabo.service
Executable file
@ -0,0 +1,5 @@
|
||||
[Unit]
|
||||
Description=Backup contabo daily
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/bruno/Backups/Contabo/backup-contabo.sh
|
10
Services/backup-contabo.sh
Executable file
10
Services/backup-contabo.sh
Executable file
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue
Block a user