Bash snippets

Aus Vosp.info
Version vom 13. November 2024, 10:11 Uhr von F (Diskussion | Beiträge) (backup entwicklerumgebung)
Wechseln zu:Navigation, Suche

Shell/bash befehle

kleine Skripte

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"