Bash snippets: Unterschied zwischen den Versionen

Aus Vosp.info
Wechseln zu:Navigation, Suche
(Die Seite wurde neu angelegt: „Shell/bash befehle = kleine Skripte = == backup entwicklerumgebung ==“)
 
(kleine Skripte)
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
Zeile 2: Zeile 2:
  
 
= kleine Skripte =
 
= kleine Skripte =
 +
 +
== backup lxd ==
 +
 +
[[Lxd#Backup_Script_LXD_Container_mit_Rsync]]
  
 
== backup entwicklerumgebung ==
 
== backup entwicklerumgebung ==
 +
 +
 +
<source lang=bash>
 +
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"
 +
</source>

Aktuelle Version vom 13. November 2024, 10:14 Uhr

Shell/bash befehle

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"