Bash snippets
Aus Vosp.info
kleine Skripte
backup lxd
Lxd#Backup_Script_LXD_Container_mit_Rsync
backup entwicklerumgebung
today=$(date "+%Y%m%d_%H%M")
basisPath="/mnt/c/Users/user/dev/"
backupFile="$1_$today$2.tar"
backupPath="/mnt/c/Users/user/backups/"
echo -e "\nbackup $backupFile"
date
cd $basisPath
# exclude strategy
#tar --exclude='images' --exclude='vendor' --exclude='webfonts' --exclude='bootstrap' --exclude='fontawesome-free-6.2.0-web' -czf $backupPath/$backupFile.gz $1
# include strategy
find ./$1 -name "*.php" -o -name "*.scss" -name "*.css" -name "*.js" -name "*.sql" -name "*.TXT" -name "*." -name "*." | tar -cf $backupPath/$backupFile -T -
#gunzip archive.tar.gz
tar -rf $backupPath/$backupFile $1/.git
gzip $backupPath/$backupFile
ls -lahrt $backupPath/$backupFile*
date
echo -e "\n"