Quick actions

cmd+k|ctrl+k

Navigation

Languages

local_backupscript

Snippet info

Language

Bash

Visibility

public

Author

info

Created

2017-07-14T21:15:31Z

Updated

2017-07-14T21:15:49Z


#!/bin/bash

#How to run
#1. Die beiden Variablen backupdir und tobackupdir anpassen
#2. Das Script irgendwo platzieren wo es nicht stoert (z.B. /root)
#3. Ein Cronjob anlegen, dort kann dann ausgewaehlt werden, wann das Bac$
#Tip: Befehl fuer Cronjob: sh /path/to/file/local_backupscript.sh
#Tip: Cronjobs koennen unter https://crontab-generator.org generiert wer$

#Benoetigte Informationen
        #Pfad wo das Backup hin soll
        backupdir="/home/scripts/backups/"
        #Welcher Pfad soll gesichert werden?
        #Der Vollstaendige Pfad wird gesichert
        tobackupdir="/home/scripts/files/"

#Script
apt-get install zip unzip -y > /dev/null
mkdir -p $tobackupdir
date=`date +%Y-%m-%d-%H-%M-%S`
filename="$backupdir""backup_""$date"".zip"
backupfiles="$tobackupdir""*"
zip $filename $backupfiles
INFO