Mikkel L. Ellertson wrote:

John Schneiderman wrote:

On Sunday 25 September 2005 20:23, Michael Hahn wrote:

I'm trying to have my server (Mandrake 10.1) run a backup each night to
CD-R. What I would like to do is put each night's backup in a directory
labeled with the date. All of the how to's I've found describe how to
write a full CD from the command prompt, but not something like I want
to do. Also (showing just how new I am to Linux) I need some help
setting up a script to run each night - I know it can be done, I'm just
not sure how to go about it.


How to run a script:

As root type crontab -e
Press the i-key to enter insert mode,
Then enter  the job you want to run as:
    Minute Hour Day Month DayOfWeek Command
Once you are done with that press the escape button.
Then type :wq
followed by enter and you've now set up a job to run when you say to.

John


For system jobs like backups, I like to create a script and put it in /etc/cron.daily instead. As far as creating a directory with the date, you can do it using the date command to generate the date. Something like this:

DATE=$(date +%F)
cd /backup
mkdir $DATE

You can then backup your files, putting them in $DATE, (or /backup/$DATE) and then build your CD image and burn it. If you want your DATE directory in a different format, look at the date man page. (man date)

Mikkel

As a further refinement, assuming that the amount of data being backed up is a fraction of the size of the CD, one could specify that one is writing to a multiple session CD in TAO mode. This may not work with all cd writers, though.
This way one could have, say, a week's backups on one CD.
(The last session has to fixate the CD, so the cron job on the last day would have to be different.

cheers
Duncan

                
___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

____________________________________________________
Want to buy your Pack or Services from Mandriva? 
Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________

Reply via email to