Thuis Pagina
Je hebt nog geen geldig gebruiker voor deze site !
aub gebruik Profile - Registreer voor een nieuwe registratie !
aub gebruik Profile - Log in voor een bestaand gebruiker !
#!/bin/bash # backup op /backup2 # be sure you have at least 6G free on /dev/myssd !! grootte=6G compress=11 thread=4 files=1000 LD="/backup2/" DIR="dir.lst" DIR2="dir2.lst" DATUM="$(date +%Y%m%d)" LF=backup_$(date +%Y%m%d).out RES=1 # only run as root if [ "$(id -u)" != '0' ] then echo "Deze bash script moet opgestart worden met root rechten" exit $RES fi echo "====== start backup ======" >>$LD$LF echo "--------------------------" >>$LD$LF rm $LD$DIR2 -v >>$LD$LF cp $LD$DIR $LD$DIR2 -v >>$LD$LF CHECKSDC="$(lsblk | grep sdc3)" CHECKSDB="$(lsblk | grep sdb3)" CHECKSDA="$(lsblk | grep sda3)" if [ ! -z "$CHECKSDA" ] then if echo "$CHECKSDA" | grep '464,3G' then SDX1="/dev/sda1" SDX2="/dev/sda2" fi fi if [ ! -z "$CHECKSDB" ] then if echo "$CHECKSDB" | grep '464,3G' then SDX1="/dev/sdb1" SDX2="/dev/sdb2" fi fi if [ ! -z "$CHECKSDC" ] then if echo "$CHECKSDC" | grep '464,3G' then SDX1="/dev/sdc1" SDX2="/dev/sdc2" fi fi RES=2 if [ -z "$SDX1" ] then cp $LD$DIR2 $LD$DIR -v >>$LD$LF echo "exit bash script : RES = $RES" exit $RES fi cd $LD TSEC=0 SECONDS=0 # backup boot no logical volume ! backup=$SDX1 backup1=/backup2/backup-boot TIMESTAMP="$(date +%Y%m%d-%Hh%M)" # lees laatste lijn line=$(tail -n 1 $LD$DIR) echo "lijn : $line" echo "datum : $DATUM" if [ $line == $DATUM ] then cp $LD$DIR2 $LD$DIR -v >>$LD$LF echo "deze backup is vandaag al eens gedaan !! Exit" exit $RES fi echo $DATUM >>$LD$DIR echo "datum $DATUM toegevoegd in $DIR" echo "datum $DATUM toegevoegd in $DIR" >>$LD$LF # lees eerste lijn uit $DIR line=$(head -n 1 $LD$DIR) echo "line is $line" if [ $line -ne $DATUM ] then # verwijder alle backups gemaakt op datum $line rm -v $LD*$line* >>$LD$LF # verwijder de eerste lijn uit $DIR sed -i 1d $LD$DIR echo "eerste lijn = $line is uit $LD$DIR" echo "eerste lijn = $line is uit $LD$DIR" >>$LD$LF fi echo "backup " $backup >>$LD$LF echo "TIMESTAMP " $TIMESTAMP >>$LD$LF df -h $LD >>$LD$LF echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup" echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup" >>$LD$LF fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup >>$LD$LF ls $backup1-$TIMESTAMP.* -la >>$LD$LF ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec" echo "duur = " $ELAPSED echo "duur = " $ELAPSED >>$LD$LF TSEC=$(($TSEC + $SECONDS)) df -h $LD >>$LD$LF SECONDS=0 backup=$SDX2 backup1=/backup2/backup-bootefi TIMESTAMP="$(date +%Y%m%d-%Hh%M)" echo "backup " $backup >>$LD$LF echo "TIMESTAMP " $TIMESTAMP >>$LD$LF echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup" echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup" >>$LD$LF fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa $backup >>$LD$LF ls $backup1-$TIMESTAMP.* -la >>$LD$LF ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec" echo "duur = " $ELAPSED echo "duur = " $ELAPSED >>$LD$LF df -h $LD >>$LD$LF TSEC=$(($TSEC + $SECONDS)) SECONDS=0 backup=/dev/mapper/myssd-root backup1=/backup2/backup-root TIMESTAMP="$(date +%Y%m%d-%Hh%M)" echo "backup " $backup >>$LD$LF echo "TIMESTAMP " $TIMESTAMP >>$LD$LF echo " lvcreate -L $grootte -s -n mysnap $backup " echo " lvcreate -L $grootte -s -n mysnap $backup " >>$LD$LF lvcreate -L $grootte -s -n mysnap $backup >>$LD$LF echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap" echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap" >>$LD$LF fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap >>$LD$LF echo " lvremove -vf /dev/mapper/myssd-mysnap " echo " lvremove -vf /dev/mapper/myssd-mysnap " >>$LD$LF lvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF ls $backup1-$TIMESTAMP.* -la >>$LD$LF ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec" echo "duur = " $ELAPSED echo "duur = " $ELAPSED >>$LD$LF df -h $LD >>$LD$LF TSEC=$(($TSEC + $SECONDS)) SECONDS=0 backup=/dev/mapper/myssd-home backup1=/backup2/backup-home TIMESTAMP="$(date +%Y%m%d-%Hh%M)" echo "backup " $backup >>$LD$LF echo "TIMESTAMP " $TIMESTAMP >>$LD$LF echo " lvcreate -L $grootte -s -n mysnap $backup " echo " lvcreate -L $grootte -s -n mysnap $backup " >>$LD$LF lvcreate -L $grootte -s -n mysnap $backup >>$LD$LF echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap" echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap" >>$LD$LF fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap >>$LD$LF echo " lvremove -vf /dev/mapper/myssd-mysnap " echo " lvremove -vf /dev/mapper/myssd-mysnap " >>$LD$LF lvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF ls $backup1-$TIMESTAMP.* -la >>$LD$LF ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec" echo "duur = " $ELAPSED echo "duur = " $ELAPSED >>$LD$LF df -h $LD >>$LD$LF TSEC=$(($TSEC + $SECONDS)) SECONDS=0 backup=/dev/mapper/myssd-data backup1=/backup2/backup-data TIMESTAMP="$(date +%Y%m%d-%Hh%M)" echo "backup " $backup >>$LD$LF echo "TIMESTAMP " $TIMESTAMP >>$LD$LF echo " lvcreate -L $grootte -s -n mysnap $backup " echo " lvcreate -L $grootte -s -n mysnap $backup " >>$LD$LF lvcreate -L $grootte -s -n mysnap $backup >>$LD$LF echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap" echo " fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap" >>$LD$LF fsarchiver -A -Z $compress -s $files -j $thread savefs $backup1-$TIMESTAMP.fsa /dev/mapper/myssd-mysnap >>$LD$LF echo " lvremove -vf /dev/mapper/myssd-mysnap " echo " lvremove -vf /dev/mapper/myssd-mysnap " >>$LD$LF lvremove -vf /dev/mapper/myssd-mysnap >>$LD$LF ls $backup1-$TIMESTAMP.* -la >>$LD$LF ELAPSED="Elapsed: $(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec" echo "duur = " $ELAPSED echo "duur = " $ELAPSED >>$LD$LF df -h $LD >>$LD$LF TSEC=$(($TSEC + $SECONDS)) ELAPSED="Elapsed: $(($TSEC / 3600))hrs $((($TSEC / 60) % 60))min $(($TSEC % 60))sec" echo "totale duur = " $ELAPSED echo "totale duur = " $ELAPSED >>$LD$LF df -h $LD >>$LD$LF TIMESTAMP="$(date +%Y%m%d-%Hh%M)" echo "TIMESTAMP " $TIMESTAMP >>$LD$LF echo "backup gedaan" >>$LD$LF echo "-------------" >>$LD$LF ls *$DATUM* -la >>$LD$LF echo "====== end backup dell latitude ======" >>$LD$LF sync RES=0 exit $RES
Sorry, er zijn nog geen commentaren voor deze Taak !
Lijst taken Nieuwe Taak Nieuwe Commentaar