mi aiutate a debuggare ?

2 risposte [Ultimo contenuto]
Ritratto di ferretti75
ferretti75
(Monster)
Offline
Monster
Iscritto: 08/07/2005
Messaggi: 476

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&#039;Callaghan &lt;danny@freebsd.org&gt;<br /># and modified by Gerhard Mourani &lt;gmourani@videotron.ca&gt;<br /># modified by Marco Ferretti &lt;marco.ferretti@gmail.com&gt; 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=&quot;/etc /home/bruno /home/marco/Documents /home/cvs&quot;           # 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 = &quot;&quot;, 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 &quot;`date` Starting backup backup script&quot; &gt; $LOGFILE<br /><br /># Monthly full backup<br />if [ $DOM = &quot;01&quot; ]; then<br />  echo &quot;`date +%d-%b-%y` Starting montly full backup&quot; &gt;&gt; $LOGFILE<br />        NEWER=&quot;&quot;<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 = &quot;Sun&quot; ]; then<br />      echo &quot;`date +%d-%b-%y` Starting weekly full backup&quot; &gt;&gt; $LOGFILE<br />        NEWER=&quot;&quot;<br />        NOW=`date +%d-%b`<br /><br />        # Update full backup date<br />#        echo $NOW &gt; $TIMEDIR/$COMPUTER-full-date<br />#        $TAR $NEWER -cjf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES<br />        echo $NOW &gt; $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=&quot;--newer `cat $TIMEDIR/$COMPUTER-full-date`&quot;<br />#        $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES<br />     echo &quot;`date +%d-%b-%y` Starting incremental backup&quot; &gt;&gt; $LOGFILE<br />        NEWER=&quot;--newer `cat $TIMEDIR/full-date`&quot;<br />        $TAR $NEWER -cjf $BACKUPDIR/weekly/$DOW.tar.bz2 $DIRECTORIES<br />fi<br />echo &quot;`date` end of backup backup script&quot; &gt;&gt; $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

magic is real ... unless explicitly declared as integer

Ritratto di marcosan
marcosan
(Collaboratore)
Offline
Collaboratore
Iscritto: 16/05/2005
Messaggi: 730

Ciao!
Devi modificare

Quote:

$TAR $NEWER -cfj $BACKUPDIR/monthly/$DM-full.tar.bz2 $DIRECTORIES

con

Quote:

$TAR $NEWER -cjf $BACKUPDIR/monthly/$DM-full.tar.bz2 $DIRECTORIES

A volte l'ordine e' importante Smile

"La matematica e' l'arte di dare lo stesso nome a cose diverse."
H.Poincare (1854-1912).

Ritratto di ferretti75
ferretti75
(Monster)
Offline
Monster
Iscritto: 08/07/2005
Messaggi: 476

mi vergogno un sacco !!

tnxs

magic is real ... unless explicitly declared as integer