]> andersk Git - moira.git/blobdiff - backup/nightly.sh
added subnets
[moira.git] / backup / nightly.sh
index 6d166c44911fbcdc04f07ae81b1d2b561bce7872..02e0f3f41b16d4a0364261fbb060f3ebdd935cc9 100644 (file)
@@ -1,18 +1,22 @@
-#!/bin/sh
+#!/bin/sh -x
 #
-#      Nightly script for backing up SMS.
+#      Nightly script for backing up Moira.
 #
 #
-BKUPDIRDIR=/tmp
-
+BKUPDIRDIR=/u3/sms_backup
+PATH=/bin:/athena/bin:/usr/athena/bin:/usr/bin:/usr/ucb:/usr/new; export PATH
 chdir ${BKUPDIRDIR}
 
+# /moira/bin/counts </dev/null 
+
 if [ -d in_progress ] 
 then
        echo "Two backups running?"
        exit 1
 fi
 
+trap "rm -rf ${BKUPDIRDIR}/in_progress" 0 1 15 
+
 if mkdir in_progress 
 then
        echo "Backup in progress."
@@ -20,8 +24,7 @@ else
        echo "Cannot create backup directory"
        exit 1
 fi
-       
-if /u1/sms/backup/smsbackup ${BKUPDIRDIR}/in_progress/
+if /moira/bin/mrbackup ${BKUPDIRDIR}/in_progress/
 then
        echo "Backup successful"
 else
@@ -29,10 +32,12 @@ else
        exit 1
 fi
 
+/moira/bin/report.sh ${BKUPDIRDIR}/in_progress > ${BKUPDIRDIR}/in_progress/report
+
 if [ -d stale ]
 then
        echo -n "Stale backup "
-       rm -rf backup_4
+       rm -r stale
        echo "removed"
 fi
 echo -n "Shifting backups "
@@ -47,6 +52,14 @@ mv in_progress backup_1
 echo 
 echo -n "deleting last backup"
 rm -rf stale
-echo "New backup:"
-ls -l backup_1
+echo "Shipping over the net:"
+rcp -rp ${BKUPDIRDIR}/* oregano:/var/moira
+rcp -rp ${BKUPDIRDIR}/* plover:/backup/moira
+
+if [ "`/usr/bin/find /moira/critical.log -mtime -1 -print`" = "/moira/critical.log" ]; then
+       (/bin/echo "To: dbadmin";\
+        /bin/echo "Subject: Moira update status";\
+        /usr/ucb/tail /moira/critical.log) | /bin/mail dbadmin
+fi
+
 exit 0
This page took 0.031339 seconds and 4 git commands to generate.