Backup shell scripts

From DreamsteepWiki

Jump to: navigation, search

example that logs the start and endtime and uses rsync localy


metrobak=/mnt/sdb1/share
dailybakpath=/mnt/sdc1/

#log time started
date | tee $dailybakpath/starttime_daily.txt

#THIS BACKS UP MP SERVER TO BAK DRIVE
#cp -r $metrobak $dailybakpath/mp_bak
rsync -av --delete --stats $metrobak $dailybakpath

#write out a text file with output from date command when done 
date | tee $dailybakpath/donebackupdaily.txt


EXAMPLE WITH RSYNC TO ANOTHER MACHINE


#local dirs 
metrobak=/metro
gisbak=/mnt/blah

monthlybakpath=/mnt/sda1/BACKUP #PATH ON MSERVER
backupserver=192.168.1.999
dailybakpath=/mnt/sdc1    #PATH ON LOCAL


#log time started
date | tee $dailybakpath/starttime_monthly.txt

#METRO (MP MG LC)
rsync $metrobak $backupserver:$monthlybakpath/METROBAK -r
date | tee $dailybakpath/doneRsyncMetro.txt

#GIS 
#rsync $gisbak $backupserver:$monthlybakpath/GISBAK -r
#date | tee $dailybakpath/doneRsyncGIS.txt

Personal tools