3 # Nightly script for backing up Moira.
7 PATH=/bin:/athena/bin:/usr/athena/bin:/usr/bin:/usr/ucb:/usr/new; export PATH
8 . /usr/ingres/sqluser.profile
11 # /moira/bin/counts </dev/null
15 echo "Two backups running?"
19 trap "rm -rf ${BKUPDIRDIR}/in_progress" 0 1 15
23 echo "Backup in progress."
25 echo "Cannot create backup directory"
29 if /moira/bin/mrbackup ${BKUPDIRDIR}/in_progress/
31 failed=`ls -s ${BKUPDIRDIR}/in_progress/ \
33 if ( FILENAME ~ /conf$/ ) {
40 for ( i in minsize ) {
41 if ( minsize[i] > size[i] ) {
46 }' ${BKUPDIRDIR}/conf -`
47 if [ "$failed" -gt 0 ]
49 echo "Backup was incomplete! $failed table(s) too small!"
50 echo "Current file sizes:"
54 echo "Backup successful"
60 /moira/bin/report.sh ${BKUPDIRDIR}/in_progress > ${BKUPDIRDIR}/in_progress/report
64 echo -n "Stale backup "
68 echo -n "Shifting backups "
76 mv in_progress backup_1
78 /bin/df /moira/moira.log | /usr/ucb/tail -1
80 echo -n "deleting last backup"
83 echo "Shipping over the net"
84 rcp -rpx ${BKUPDIRDIR}/* oregano:/backup
85 rcp -rpx ${BKUPDIRDIR}/* nessus:/backup/moira
87 if [ "`/usr/bin/find /moira/critical.log -mtime -1 -print`" = "/moira/critical.log" ]; then
88 (/bin/echo "To: dbadmin";\
89 /bin/echo "Subject: Moira update status";\
90 /usr/ucb/tail /moira/critical.log) | /bin/mail dbadmin
93 plfile=/afs/athena.mit.edu/system/info/public-mailing-lists
94 awk -F\| '$3==1 && $4==1 && $5==0 && $6==1 {printf "%-20s %s\n", $1, $9}' \
95 ${BKUPDIRDIR}/backup_1/list \
96 | sort > $plfile.new && mv -f $plfile.new $plfile