Sono frustrato .
Ho cercato nella rete ( e ho trovato e leggermente modificato ) uno script per fare dei backup con un ciclo di 6+1+12 ( uno incrementale ogni giorno, 1 completo alla settimana -- a giro -- e uno completo al mese ) .
ecco lo script : <br />#!/bin/bash<br /># full and incremental backup script<br /># created 07 February 2000<br /># Based on a script by Daniel O'Callaghan <danny@freebsd.org><br /># and modified by Gerhard Mourani <gmourani@videotron.ca><br /># modified by Marco Ferretti <marco.ferretti@gmail.com> on 01 May 2008<br /><br />#Change the 5 variables below to fit your computer/backup<br /><br />#COMPUTER=server # name of this computer<br />DIRECTORIES="/etc /home/bruno /home/marco/Documents /home/cvs" # directoris to backup<br />BACKUPDIR=/media/disk/backup/archives # where to store the backups<br />TIMEDIR=/media/disk/backup/log # where to store time of full backup<br />TAR=/bin/tar # name and locaction of tar<br />LOGFILE=/media/disk/backup/log/backup.log # log file <br />#You should not have to change anything below here<br /><br />PATH=/usr/local/bin:/usr/bin:/bin<br />DOW=`date +%a` # Day of the week e.g. Mon<br />DOM=`date +%d` # Date of the Month e.g. 27<br />DM=`date +%d%b` # Date and Month e.g. 27Sep<br /><br /># On the 1st of the month a permanet full backup is made<br /># Every Sunday a full backup is made - overwriting last Sundays backup<br /># The rest of the time an incremental backup is made. Each incremental<br /># backup overwrites last weeks incremental backup of the same name.<br />#<br /># if NEWER = "", then tar backs up all files in the directories<br /># otherwise it backs up files newer than the NEWER date. NEWER<br /># gets it date from the file written every Sunday.<br /><br /><br />echo "`date` Starting backup backup script" > $LOGFILE<br /><br /># Monthly full backup<br />if [ $DOM = "01" ]; then<br /> echo "`date +%d-%b-%y` Starting montly full backup" >> $LOGFILE<br /> NEWER=""<br /># $TAR $NEWER -cfj $BACKUPDIR/$COMPUTER-$DM.tar.bz2 $DIRECTORIES<br /> $TAR $NEWER -cfj $BACKUPDIR/monthly/$DM-full.tar.bz2 $DIRECTORIES<br />fi<br /><br /># Weekly full backup<br />if [ $DOW = "Sun" ]; then<br /> echo "`date +%d-%b-%y` Starting weekly full backup" >> $LOGFILE<br /> NEWER=""<br /> NOW=`date +%d-%b`<br /><br /> # Update full backup date<br /># echo $NOW > $TIMEDIR/$COMPUTER-full-date<br /># $TAR $NEWER -cjf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES<br /> echo $NOW > $TIMEDIR/full-date<br /> $TAR $NEWER -cjf $BACKUPDIR/weekly/$DOW-full.tar.bz2 $DIRECTORIES<br /># Make incremental backup - overwrite last weeks<br />else<br /> # Get date of last full backup<br /># NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"<br /># $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES<br /> echo "`date +%d-%b-%y` Starting incremental backup" >> $LOGFILE<br /> NEWER="--newer `cat $TIMEDIR/full-date`"<br /> $TAR $NEWER -cjf $BACKUPDIR/weekly/$DOW.tar.bz2 $DIRECTORIES<br />fi<br />echo "`date` end of backup backup script" >> $LOGFILE<br />
e fatto girare dal crontab di root :
<br />SHELL=/bin/bash<br /># m h dom mon dow command<br />0 6 * * * /usr/sbin/backup.sh<br />
Funziona benissimo tutti i giorni, fà il backup completo la domenica e l'incrementale dal lunedì al sabato . L'unico problema è che non fà il backup mensile ... e francamente non capisco il perchè .
Mi date una mano a capire dove stà l'inghippo (apparte l'evidente errore nello scrivere monthly che però è correttamente replicato nel file system )??
TIA
Marco



Ciao!
Devi modificare
Quote:
con
Quote:
A volte l'ordine e' importante
"La matematica e' l'arte di dare lo stesso nome a cose diverse."
H.Poincare (1854-1912).