writting a backup shell script
hi, i want to write a bash shell script to backup my cvs source code.
i have no idea to make it improving since i dunno how to write a bash script.
here is my starting of my script.
#!/bin/sh
date=`date -I`
tar cvfz cvsroot-$date.tar.gz /usr/cvsroot/
can u help me to tar my cvsroot-$date.tar.gz into directory /mnt/MIS ??
and also, i wish to backup my data for a week, then, the script will delete data after a week. and start to generate the backup file for a subsequent new week.
the algorithm will be like this.
for(day=monday; day<sunday; day++){
//monday
if(day == monday){
if(no storage for last monday)
backup data for monday
else{
delete the storage for last monday
backup data for monday
}
}
//tuesday
if(day == tuesday ){
if(no storage for last tuesday)
backup data for tuesday
else{
delete the storage for last tuesday
backup data for tuesday
}
}
//.......the same thing goes for wed, thurs, fri, sat and sun..
}
i will later cron it for daily activity...
thanks...
|