Monday 5 December 2011

little help with my backup script please

little help with my backup script please

Im pretty new to linux and shell scripting and im trying to learn it
Im trying to make a script that makes a backup of my home folder into /tmp/backup (this part i can do)

but also if the dir /tmp/back does not excist i want the script to create it

this is what i have so far but i cant reall get it to work :p

Code:

BRONDIR=/home/draxor
BESTEMMINGDIR=/home/tmp/backup
FILENAAM=Backup-$(date +%-y%-m%-d)-$(date +%-T).bac
tar --create --gzip --file=$BESTEMMINGDIR$FILENAAM $BRONDIR

PATH=$/home/draxor/backup
If [ -d $PATH];
Then
Cp backup.bac /home/draxor
Else
Mkdir $PATH
Echo "backup folder wordt aangemaakt & bestanden worden gekopieerd"
Cp backup.bac /home/draxor/
Fi

No comments:

Post a Comment