Home_ghost

#MASK

echo "============================================================"
echo " 1 - List Home Dir"
echo " 2 - Backup Home Dir"
echo " 3 - List Backup sets"
echo " 4 - Recovery Home"
echo " 5 - Deletion of Backup set"
echo " 6 - Quit"
echo "============================================================"
echo -e " Please enter one of the option --> \c"
read MENU

until [ “$MENU” -le “6” ]
do
echo -e " Please enter one of the option --> \c"
read MENU
done

if [ -z “$MENU” ]
then
echo " Please enter one of the option"
echo -e " Please enter one of the option --> \c"
read MENU
echo "Program will be closed since you did not have enter nothing for 2x times"
exit
else
if [ “$MENU” = “6” ]
then
exit
else

if [ “$MENU” = “1” ]
then
echo "List Home Directory"
echo ""
echo ""
echo "==========================================================="
ls -ali /home/die7/
echo ""
echo ""
echo “============================================================”

echo "==========================================================="
echo " 1 - List Home Dir"
echo " 2 - Backup Home Dir"
echo " 3 - List Backup sets"
echo " 4 - Recovery Home"
echo " 5 - Deletion of Backup set"
echo " 6 - Quit"
echo "==========================================================="
echo -e " Please enter one of the option --> \c"
read MENU

until [ “$MENU” -le “6” ]
do
echo -e " Please enter one of the option --> \c"
read MENU

if [ -z “$MENU” ]
then
echo " Please enter one of the option"
echo -e " Please enter one of the option --> \c"
read MENU
echo "Program will be closed since you didi not heve enter nothing for 2x times"
exit
else

if [ “$MENU” = “2” ]
then
clear
echo " Backup of Home Directory"
echo ""
echo ""
echo "=============================================================="
echo ""
tar -czvf /tmp/backup_homes/backup_home.tar.gz /home/die7/
echo ""
echo ""
echo “”

echo “Backup done!”

echo "=============================================================="
echo " 1 - List Home Dir"
echo " 2 - Backup Home Dir"
echo " 3 - List Backup sets"
echo " 4 - Recovery Home"
echo " 5 - Deletion of Backup set"
echo " 6 - Quit"
echo "==============================================================="
echo -e " Please enter one of the option --> \c"
read MENU

until [ “$MENU” -le “6” ]
do
echo -e " Please enter one of the option --> \c"
read MENU
done

if [ -z “$MENU” ]
then
echo " Please enter one of the option"
echo -e " Please enter one of the option --> \c"
read MENU
echo "Program will be closed since you didi not heve enter nothing for 2x times"
exit
else

if [ “$MENU” = “3” ]
then
clear
echo "List Backup Sets"
echo ""
echo ""
echo "==================================================================="
ls /tmp/backup_homes/
echo ""
echo ""
echo ""
echo “”

echo “List of Backup Sets done!”

echo "=================================================================="
echo " 1 - List Home Dir"
echo " 2 - Backup Home Dir"
echo " 3 - List Backup sets"
echo " 4 - Recovery Home"
echo " 5 - Deletion of Backup set"
echo " 6 - Quit"
echo "=================================================================="
echo -e " Please enter one of the option --> \c"
read MENU

until [ “$MENU” -le “6” ]
do
echo -e " Please enter one of the option --> \c"
read MENU
done

if [ -z “$MENU” ]
then
echo " Please enter one of the option"
echo -e " Please enter one of the option --> \c"
read MENU
echo "Program will be closed since you didi not heve enter nothing for 2x times"
exit
else

if [ “$MENU” = “4” ]
then
clear
echo "Recovery of Home Directory"
echo ""
echo ""
echo "======================================================================="
tar -xzvf /tmp/backup_homes/backup_home.tar.gz -C /
echo ""
echo ""
echo “======================================================================”

echo "Recover of Home Directory done"
echo "======================================================================"
echo " 1 - List Home Dir"
echo " 2 - Backup Home Dir"
echo " 3 - List Backup sets"
echo " 4 - Recovery Home"
echo " 5 - Deletion of Backup set"
echo " 6 - Quit"
echo "======================================================================"
echo -e " Please enter one of the option --> \c"
read MENU

until [ “$MENU” -le “6” ]
do
echo -e " Please enter one of the option --> \c"
read MENU
done

if [ -z “$MENU” ]
then
echo " Please enter one of the option"
echo -e " Please enter one of the option --> \c"
read MENU
echo "Program will be closed since you didi not heve enter nothing for 2x times"
exit
else

if [ “$MENU” = “5” ]
then
clear
echo "Del Backup set"
echo ""
echo ""
echo "=============================================================================="
rm -rf /tmp/backup_homes/backup_home.tar.gz
echo ""
echo “”

echo "Deletion fo Backup Sets done!"
echo "======================================================================"
echo " 1 - List Home Dir"
echo " 2 - Backup Home Dir"
echo " 3 - List Backup sets"
echo " 4 - Recovery Home"
echo " 5 - Deletion of Backup set"
echo " 6 - Quit"
echo "======================================================================"
echo -e " Please enter one of the option --> \c"
read MENU

until [ “$MENU” -le “6” ]
do
echo -e " Please enter one of the option --> \c"
read MENU
done

if [ -z “$MENU” ]
then
echo " Please enter one of the option"
echo -e " Please enter one of the option --> \c"
read MENU
echo "Program will be closed since you didi not heve enter nothing for 2x times"
exit
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi

Trenutno funkcije scripta radi serijalno, ili jedna opcija ili quit ili sev jedna za drugom, ponavljanje tj prekanje opcija jos nije odradjeno
Pisanje scripta je trajalo sa testiranjem 30min

Slijedi poprave i dodatne funkcije:

  1. Integracija locate i find
  2. pisanje funkcija i skokova ala goto da bi se ustedilo copy&paste
  3. Izabir file/directrory/partiton od koje se zeli napraviti backup
  4. Izabir directory gdje se zeli pohraniti backup kao i davanje imena backup setu
  5. Pravljenje GUI za aplikaciju ala dialaog
    6…jos nesto ako mi pane na pamet
    7…jos nesto ako nekom drugom padne na pamet

toliko

naravno i gramatika a pogotovo jamericki treba se poraviti :slight_smile:

  1. Postavljanje backup-jobova u crontab (definicja sta i kad)
  2. Particijalni recover(izabir samo jednog ili vise fajlova)
  3. md5 summe backupa, fajlova,recovery
  4. dekryptanje backupa
  5. progres linija i procenti i vrijeme

Takodje se svako moze ukljuciti u projekat, uslov je da se radi u bashu scriptom jeziku sto i jeste moj cilj pokazati koliko je on u stvari jak, mada i aplikacija bi mogla liciti na nesto ako bi se ozbiljno odradili ovi koraci naravno i predlozi…ko voli nek izvoli

Posebno mi se sviđa 11 fi-jeva na kraju :slight_smile:

hahaha, sto je sigurno sigurno konto da se ne zabrojim…no kao sto rekoh to je bilo 15min rada 15min kontanja, cesto se kod mene desi da je kontanje bolje od rada ali , polako nadoce to

Mnogo elegantnija verzija je
mucl005:/tmp# cat script07.sh

#MASK

Menu(){

echo "==========================================================="
echo " 1) - List Home Dir"
echo " 2) - Backup Home Dir"
echo " 3) - List Backup Sets"
echo " 4) - Recovery Home Directory"
echo " 5) - Deletion of Backup Sets"
echo " q) - Quit"
echo "===========================================================“
echo " Please enter one of the option --> \c”
}

while [ 1 ]
do
Menu
read CHOICE
case “$CHOICE” in
"1")
echo ""
echo "“
echo”"
echo " Your Home Directory: "
echo "==========================================================="
ls -ali $HOME
echo “============================================================”
;;
“2”)

echo " Backup of Home Directory"
echo ""
echo ""
echo "=============================================================="
echo ""
mkdir /tmp/backup_homes/$USER
chmod 777 /tmp/backup_homes/ -R

tar -czvf /tmp/backup_homes/$USER/backup_home-$(date +%d.%m.%y-%R).tar.gz $HOME
echo ""
echo ""
echo “”

echo “Backup done!”
;;

“3”)

echo "List Backup Sets"
echo ""
echo ""
echo "==================================================================="
ls /tmp/backup_homes/$USER
echo ""
echo ""
echo ""
echo “”

echo “List of Backup Sets done!”
;;

“4”)

echo "Recovery of Home Directory"
echo ""
echo ""
echo "======================================================================="
echo " Please enter full name of the backup: "
read BACKUP
tar -xzvf /tmp/backup_homes/$USER/$BACKUP -C /
echo ""
echo ""
echo “======================================================================”
;;

“5”)

echo "Delete Backup Sets"
echo ""
echo ""
echo "=============================================================================="
rm -rf /tmp/backup_homes/$USER
echo ""
echo “”

echo "Deletion of the Backup Sets done!"
echo “======================================================================”
;;

“q”)
exit
esac
done

Naravno ovo bolja funkcionise ostalo je integracija :

  • locate
  • find
  • Alternativni izbor (izabrati file za backup ili recovery)
  • Sigurnost (chmod bas nisam odradio kako treba, mozda chmod 777 /tmp/backup_homes
    mkdir /tmp/backup_homes/$USER
    chmod 722 /tmp/backup_homes/$USER izgleda bolje ili nesto sasvim ljevo treba ovdje)
  • List sadrzaja backupa
  • backup & restore HDD
  • progres linija i vrijeme
  • Dialog gui
  • md5
  • crypto
  • crontab

naravno i jos ponesto (Vedran valjal sad ista :slight_smile: )

nastavice se…

sad je pitanje samo koliko zauzima home, sto bi mozda moglo da se resi sa increment backup-om, a da i dalje koristis tar :slight_smile:

[code]#!/bin/bash

LOG=/var/log/backup.log
INCLOG=/var/log/inc.backup.log
DAY=Sun

If it’s d-day, make full backup

if [[ $(date ‘+%a’) = $DAY ]]
then
echo “Doing full backup @ $(date ‘+%d.%m.%Y - %A - %H:%M:%S’)” >> $LOG
echo “” > $INCLOG
tar -g $INCLOG -zcvf /home/backup/$(date ‘+%y.%m.%d’).backup.tgz /var/www/ /var/lib/mysql /etc
echo “Done with full backup @ $(date ‘+%d.%m.%Y - %A - %H:%M:%S’)” >> $LOG
else

Otherwise incremental

echo “Doing incremental backup @ $(date ‘+%d.%m.%Y - %A - %H:%M:%S’)” >> $LOG
tar -g $INCLOG -zcvf /home/backup/$(date ‘+%y.%m.%d’).inc.backup.tgz /var/www/ /var/lib/mysql /etc
echo “Done with incremental backup @ $(date ‘+%d.%m.%Y - %A - %H:%M:%S’)” >> $LOG
fi[/code]

Da, hvala na podsjecanju inkremental ce biti kao i zipovanje ukljuceno :slight_smile: jos ideja?

  • nakon kreiranja backup-a ili pri provjeri postojecih da tar --list , cisto za informaciju korisniku sta je to sve spakovano

  • 2 opcije silent i interactive, gdje ce se silent koristiti za crontab uz obavijestenje korisnika ako nesto nije ok

  • enkripcija sa gpg-om ili blowfish (as in your avatar :smiley: ) kao opcija , mozda nesto ovako: http://forum.linux.org.ba/viewtopic.php?id=4625 samo ne znam bas za 4096bit blowfish na par GB :smiley:

  • ako se koristi zasebna particija za backup, da se umount odradi nakon kreiranja, ako se izvrsava pod root acc ili dozvoliti sa sudo nopass samo tu komandu

  • mogucnost remote storage-a, dal’ na neke servise kao sto je dropbox ili definisani ftp/sftp server (ako to bandwith dozvoljava u razumnim granicama)

Što ne bi valjalo ako radi? :slight_smile:

bump, imal’ kakav update za ovo ? :slight_smile:

ima samo nema mene nidje

ma ovo je cista zeza moguce jednog dana da uzmem ovo zaista odraditi (molim da izbjegnete sve gramaticke greske i ine) :slight_smile:
u jednom fajlu mi postalo pretjesno :slight_smile: a imam i jos hiljadu stvari da se uradi
da bi kritoplogija fubkcionisala treba instalirati mcrypt!

#2011 die7
#MASK
clear
Menu(){

echo “==========================================================================”
echo " HOME GHOST"
echo “==========================================================================”
echo " 1) - List Home Dir"
echo " 2) - Backup Home Dir"
echo " 3) - List Backup Sets"
echo " 4) - List content of backup archive"
echo " 5) - Recovery Home Directory"
echo " 6) - Deletion of Backup Sets"
echo " 7) - encrypt your Backup Set *Dangerus please do not forget a password, orgin backup will be deleted after encryption!!"
echo " 8) - decrypt your Backup Set *decrypted file will be deleted after decryption!!"
echo " q) - Quit"
echo “==========================================================================”
echo " Please enter one of the option → \c"
}

while [ 1 ]
do
Menu
read CHOICE
case “$CHOICE” in

    "1")

clear
echo “”
echo “”
echo “”
echo " Content of your Home Directory: "
echo “========================================================================”
ls -ali $HOME
echo “========================================================================”
;;
“2”)
clear
echo " Backup of Home Directory"
echo “”
echo “”
echo “========================================================================”
echo “”
mkdir /tmp/backup_homes/ 2> /dev/null
mkdir /tmp/backup_homes/$USER 2> /dev/null
chmod 777 /tmp/backup_homes/$USER -R 2> /dev/null

tar -czf /tmp/backup_homes/$USER/backup_home_$USER-$(date +%d.%m.%y-%R).tar.gz $HOME
md5sum /tmp/backup_homes/$USER/.gz > /tmp/backup_homes/$USER/.md5summ.log 2>/dev/null
#rm -rf /tmp/backup_homes/$USER/
.gz
chmod 700 /tmp/backup_homes/$USER -R 2> /dev/null
echo “”
echo “”
echo “”
echo “Yor backup archive is /tmp/backup_homes/$USER/ with md5sum of file >”
cat /tmp/backup_homes/$USER/.md5summ.log|tail -1 2> /dev/null
;;

“3”)
clear
echo “List Backup Sets”
echo “”
echo “”
echo “========================================================================”

echo " current backup archives in backup folder: /tmp/backup_homes/$USER/"
ls -l /tmp/backup_homes/$USER 2> /dev/null
echo “md5sum of files:”
tac /tmp/backup_homes/$USER/.md5summ.log 2> /dev/null
echo “”
echo “”
echo “”
echo “”
echo “List of Backup Sets done!”
;;

  "4")

clear
echo " List content of backup archive!"
echo “”
echo “”
echo “========================================================================”
echo “”
ls -lrth /tmp/backup_homes/$USER
echo “please copy & paste name of archive!”
read num
tar -ztvf /tmp/backup_homes/$USER/$num 2> /tmp/backup_homes/$USER/.issue1.log
cat /tmp/backup_homes/$USER/.issue1.log
echo “”
echo “”
echo “list end!”
;;

“5”)
clear
echo “Recovery of Home Directory”
echo “”
echo “”
echo “========================================================================”
echo " Please enter full name of the backup: "
ls -li /tmp/backup_homes/$USER
read BACKUP
tar -xzvf /tmp/backup_homes/$USER/$BACKUP -C / 2> /tmp/backup_homes/$USER/.issue2.log
cat /tmp/backup_homes/$USER/.issue2.log
echo""
echo""
echo “Recovery of your Home directory is done!!”
echo “”
echo “========================================================================”
;;

“6”)
clear
echo “Delete Backup Sets”
echo “”
echo “”
echo “========================================================================”
rm -rf /tmp/backup_homes/$USER/*
rm -rf /tmp/backup_homes/$USER/.md5summ.log
rm -rf /tmp/backup_homes/$USER/.iss*
echo “”
echo “”
echo “Deletion of the Backup Sets done!”
echo “========================================================================”
;;
“7”)
clear
echo “encrypt Backup Sets”
echo “”
echo “”
echo “========================================================================”
ls -li /tmp/backup_homes/$USER
echo “enter par copy&paste name you wish to encrypt”
read enc

mcrypt -u /tmp/backup_homes/$USER/$enc
echo “”
echo “”
echo “encryption of the Backup Set done!”
echo “========================================================================”
;;
“8”)
clear
echo “decrypt Backup Sets”
echo “”
echo “”
echo “========================================================================”
ls -li /tmp/backup_homes/$USER
echo “enter par copy&paste name you wish to decrypt”
read enc

mcrypt -ud /tmp/backup_homes/$USER/$enc
echo “”
echo “”
echo “decryption of the Backup Sets done!”
echo “========================================================================”
;;

“q”)
exit
esac
done

rather interesting, I must say…

Yes, indeed.