]> andersk Git - moira.git/blobdiff - backup/nightly.sh
Diane Delgado's changes for a fixed table-locking order
[moira.git] / backup / nightly.sh
index 02e0f3f41b16d4a0364261fbb060f3ebdd935cc9..8b7bb9a609b77354bc3632c4e770817fff8cc96d 100644 (file)
@@ -1,10 +1,11 @@
-#!/bin/sh -x
+#!/bin/sh
 #
 #      Nightly script for backing up Moira.
 #
 #
-BKUPDIRDIR=/u3/sms_backup
+BKUPDIRDIR=/backup
 PATH=/bin:/athena/bin:/usr/athena/bin:/usr/bin:/usr/ucb:/usr/new; export PATH
+. /usr/ingres/sqluser.profile
 chdir ${BKUPDIRDIR}
 
 # /moira/bin/counts </dev/null 
@@ -24,8 +25,32 @@ else
        echo "Cannot create backup directory"
        exit 1
 fi
+chmod 750 in_progress
 if /moira/bin/mrbackup ${BKUPDIRDIR}/in_progress/
 then
+       failed=`ls -s ${BKUPDIRDIR}/in_progress/ \
+               | awk ' !/total/ { 
+                         if ( FILENAME ~ /conf$/ ) {
+                           minsize[$2]=$1;
+                         } else {
+                           size[$2]=$1
+                         }
+                       } 
+                       END {
+                         for ( i in minsize ) {
+                           if ( minsize[i] > size[i] ) {
+                             j+=1
+                           }
+                         }
+                         print j
+                       }' ${BKUPDIRDIR}/conf -`
+       if [ "$failed" -gt 0 ]
+       then
+               echo "Backup was incomplete!  $failed table(s) too small!"
+               echo "Current file sizes:"
+               ls -s in_progress/
+               exit 1
+       fi
        echo "Backup successful"
 else
        echo "Backup failed!"
@@ -43,18 +68,21 @@ fi
 echo -n "Shifting backups "
 
 mv backup_3 stale
-echo -n "3"
+echo -n "3 "
 mv backup_2 backup_3
-echo -n "2"
+echo -n "2 "
 mv backup_1 backup_2
-echo -n "1"
+echo -n "1 "
 mv in_progress backup_1
+echo
+/bin/df /moira/moira.log | /usr/ucb/tail -1
 echo 
 echo -n "deleting last backup"
 rm -rf stale
-echo "Shipping over the net:"
-rcp -rp ${BKUPDIRDIR}/* oregano:/var/moira
-rcp -rp ${BKUPDIRDIR}/* plover:/backup/moira
+echo
+echo "Shipping over the net"
+rcp -rpx ${BKUPDIRDIR}/* oregano:/backup
+rcp -rpx ${BKUPDIRDIR}/* nessus:/backup/moira
 
 if [ "`/usr/bin/find /moira/critical.log -mtime -1 -print`" = "/moira/critical.log" ]; then
        (/bin/echo "To: dbadmin";\
@@ -62,4 +90,9 @@ if [ "`/usr/bin/find /moira/critical.log -mtime -1 -print`" = "/moira/critical.l
         /usr/ucb/tail /moira/critical.log) | /bin/mail dbadmin
 fi
 
+plfile=/afs/athena.mit.edu/system/info/public-mailing-lists
+awk -F\| '$3==1 && $4==1 && $5==0 && $6==1 {printf "%-20s %s\n", $1, $9}' \
+       ${BKUPDIRDIR}/backup_1/list \
+       | sort > $plfile.new && mv -f $plfile.new $plfile
+
 exit 0
This page took 0.037533 seconds and 4 git commands to generate.