LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-18-2004, 07:33 PM   #1
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Rep: Reputation: 30
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...
 
Old 03-18-2004, 07:46 PM   #2
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Doubt anyone will write your script for you. So if you know the functional outline of what you want to do, read this. And might as well put #!/bin/bash even though sometimes /bin/sh -> /bin/bash
 
Old 03-18-2004, 07:49 PM   #3
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Original Poster
Rep: Reputation: 30
ok...thanks for ur guidance of /bin/sh -> /bin/bash
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script to remove backup ~ files hallamigo Linux - General 3 09-13-2010 03:47 PM
problem writting a shell in c maritos Programming 2 10-06-2005 02:57 PM
Shell Script for backup BBQ_Matt Linux - Software 7 06-30-2005 05:19 PM
Incremental Backup shell script. datadriven Linux - General 3 06-02-2004 09:19 AM
bash shell backup script turnip Programming 0 04-03-2003 06:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration