3 # Nightly script for backing up Moira.
7 PATH=/usr/athena/bin:/bin:/usr/bin:/usr/ucb; export PATH
8 ORACLE_HOME=/usr/oracle; export ORACLE_HOME
9 ORACLE_SID=moira; export ORACLE_SID
14 echo "Two backups running?"
18 trap "rm -rf ${BKUPDIRDIR}/in_progress" 0 1 15
22 echo "Backup in progress."
24 echo "Cannot create backup directory"
28 if /moira/bin/mrbackup ${BKUPDIRDIR}/in_progress/
30 failed=`ls -s ${BKUPDIRDIR}/in_progress/ \
32 if ( FILENAME ~ /conf$/ ) {
39 for ( i in minsize ) {
40 if ( minsize[i] > size[i] ) {
45 }' ${BKUPDIRDIR}/conf -`
46 if [ "$failed" -gt 0 ]
48 echo "Backup was incomplete! $failed table(s) too small!"
49 echo "Current file sizes:"
53 echo "Backup successful"
59 /moira/bin/report.pl ${BKUPDIRDIR}/in_progress > ${BKUPDIRDIR}/in_progress/report
63 /usr/ucb/echo -n "Stale backup "
67 /usr/ucb/echo -n "Shifting backups "
75 mv in_progress backup_1
77 /bin/df -k /moira/moira.log | /usr/ucb/tail -1
79 echo "deleting last backup"
82 echo "Shipping over the net"
83 rcp -rpx ${BKUPDIRDIR}/* oregano:/backup
84 rcp -rpx ${BKUPDIRDIR}/* nessus:/backup/moira
86 if [ "`/usr/bin/find /moira/critical.log -mtime -1 -print`" = "/moira/critical.log" ]; then
87 (/bin/echo "To: dbadmin";\
88 /bin/echo "Subject: Moira update status";\
89 /usr/ucb/tail /moira/critical.log) | /bin/mail dbadmin
92 plfile=/afs/athena.mit.edu/system/info/public-mailing-lists
93 awk -F\| '$3==1 && $4==1 && $5==0 && $6==1 {printf "%-20s %s\n", $1, $9}' \
94 ${BKUPDIRDIR}/backup_1/list \
95 | sort > $plfile.new && mv -f $plfile.new $plfile