Dave Howorth wrote:
> Matthias Bachert wrote:
>>>> There are no logs in the other vaults. There isn't even a directory 
>>>> created for that particular day.
>>> That's weird. The process isn't still running, is it?
>> It doesn't seem so. ps axu|grep dirvish and ps axu|grep rsync yields
>> nothing.
>>  
>>>> What do you mean with "the output of dirvish-runall"?
>>> Well mine looks like this. Notice that one job failed but it 
>>> carried on to do the rest:
>> It says something like such:
>>
>> ================== wwwdev2_home ==================
>> ** WARNING: This machine not backed up!
>>              (last backup: 20080331)
> 
> That's not a message that can ever be produced by the dirvish or
> dirvish-runall that I'm using, as far as I can tell !?
> 
> What version are you using? I guess you're using some other wrapper
> script or something.
> 
> Cheers, Dave
> _______________________________________________
> Dirvish mailing list
> [email protected]
> http://www.dirvish.org/mailman/listinfo/dirvish
> 
Hi,
thats a message produced by a script, it was posted a while ago called 
dirvish-mail or something similar. It looks through all the vaults or 
banks and takes the last directory in each by date, and reads out the 
rsync log and stuff. This means the last directory by date was 31/3.

Cheers Brian

BTW If anyone is interested I changed it a bit for my purposes, this is 
the one I now use, it runs after dirvish and gives me an email with a 
summary of what dirvish did today. Oh, and no jokes about my scripting 
skills please, I'm still learning. BTW I ping each machine to see if it 
is on, if it is then I run dirvish against it. This is running on an 
Unslung NSLU2:

#! /bin/sh 

 

#set -x 

 

logger "/opt/sbin/dirvish-mail Started" 

 

# Set Variables 

VAULTS="/public/backup" 

CONFIG=/etc/dirvish/master.conf 

USAGE=/home/diskusage.txt 

TMPFILE=/tmp/dirvish.status.$$.txt 

TODAY=`date -d "TODAY" +%Y%m%d?????` 

TODAY2=`date -d "TODAY"` 

WARNINGS="" 

FLAGS="[" 

#BACKUP="None" 

 

# Loop through all vaults 

for VAULT in $VAULTS 

do 

   cd $VAULT || (echo "$0: ERROR: Please set the VAULT variable"; exit 
1)
   for machine in `ls|grep -v lost+found` 

   do 

     if [ "$machine" = "Archive_1" ] || [ "$machine" = "slug1-messages" 
]
         then 

         # These two directories are not done via dirvish 

         # so just ignore them 

     else 

         cd $machine 

 

         # Check for a summary or log file (at least one should be 

         # present if a backup occurred 

         if [ ! -f $TODAY/log -o ! -f $TODAY/summary ] 

             then 

             # No backup from today's date 

             FLAGS="$FLAGS-" 

 

             # If no backup last night, then warn. 

             # Also, try to guess the last night a backup occurred. 

             # (yes, it's crude.) 

             last=`(ls -dt [0-9]* 2>/dev/null)|head -1` 

 

             if [ "z$last" = "z" ] 

                 then 

                 last="NEVER" 

                 fi 

 

             printf "%-16s %-3s %-6s %-2s %-6s %-4s %-4s %-13s \n" 
$machine "Not backed up today! Last was:" $last
 

             WARNINGS="$WARNINGS $machine" 

         else 

             # Backup exists 

 

             # get the name of the last backup 

             BACKUP=`(ls -dt [0-9]* 2>/dev/null)|head -1` 

 

             # If there is no Status: success, the backup probably 
wasn't successful.
             # It could be that the backup is still running, but its 
still worth a look.
             if [ `grep -c "Status: success" $BACKUP/summary` -eq "0" ] 

                 then 

                 printf "%-16s %-7s %-6s %-3s %-11s \n" $machine 
"Today's Backup not successful!"
                 FLAGS="$FLAGS!"
             else 

                 # Backup seems to be OK 

                 FLAGS="$FLAGS+" 

 

                 # Copy data from the Summary and stats log file 

                 start=`(grep -v "^ "|grep "Backup-begin:") < 
$BACKUP/summary`
                 set -- $start 

                 start="$3" 

 

                 end=`(grep -v "^ "|grep "Backup-complete:") < 
$BACKUP/summary`
                 set -- $end 

                 end="$3" 

 

                 #bytes=`(grep -v "^ "|grep "Total transferred file 
size:") < $BACKUP/log`
                 #set -- $bytes 

                 #bytes="$5" 

 

                 bytes=`(grep -v "^ "|grep "Literal data:") < 
$BACKUP/log`
                 set -- $bytes 

                 bytes="$3" 

 

 

                 printf "%-16s %-6s %-9s %-4s %-9s %-4s %10s %-5s  \n" 
$machine "Start:" $start "End:" $end "Data =" $byt
 

                 fi 

             fi         # End else 

         cd .. 

         fi 

   done >> $TMPFILE 

 

done 

 

###### All Vaults have been processed ##### 

 

# Complete the FLAGS field 

FLAGS="$FLAGS]" 

 

 

# Add Footer to the file sent 

echo ""                                                 >> $TMPFILE 

echo "Disk Usage Summary. After:"                       >> $TMPFILE 

echo ""                                                 >> $TMPFILE 

test=$(df | grep "Filesystem") 

echo "$test"                                            >> $TMPFILE 

test=$(df | grep "rootfs") 

echo "$test"                                            >> $TMPFILE 

echo "$TODAY2 $test"                                    >> $USAGE 

echo ""                                                 >> $TMPFILE 

 

 

 

# Send the report and Log the Subject line 

 

logger "/opt/sbin/dirvish-mail Backup status: $FLAGS ${BACKUP}" 

.  mailtext.sh   "Backup status: $FLAGS ${BACKUP}" "$(cat $TMPFILE)" 

 

#cat $TMPFILE 

 

 

# Cleanup 

rm -f $TMPFILE 


 

logger "/opt/sbin/dirvish-mail Done" 


Output mail looks like this:

IBM-rexx         Not backed up today! Last was: 20080331-2021 

IBM-tp           Not backed up today! Last was: 20080331-2018 

brian            Not backed up today! Last was: 20080331-2014 

brian-linux      Not backed up today! Last was: 20080331-2017 

diane            Not backed up today! Last was: 20080315-2013 

slug1-system     Start: 20:15:19  End: 20:15:37  Data =       1655 Bytes
slug2-messages   Not backed up today! Last was: 20080328-2016 

slug2-system     Not backed up today! Last was: 20080328-2016 

vdr-etc          Start: 20:14:42  End: 20:14:47  Data =         45 Bytes
vdr-etc-test     Today's Backup not successful!
vdr-sbin         Start: 20:14:50  End: 20:14:50  Data =          0 Bytes
vdr-sbin-test    Today's Backup not successful!
vdr-src          Start: 20:14:24  End: 20:14:33  Data =       4085 Bytes
vdr-src-test     Today's Backup not successful!

Disk Usage Summary. After:

Filesystem           1k-blocks      Used Available Use% Mounted on
rootfs               307489140  99356480 192513064  34% /



_______________________________________________
Dirvish mailing list
[email protected]
http://www.dirvish.org/mailman/listinfo/dirvish

Reply via email to