SUMMARY: ufsdump email alert ?

From: Bousquet Francois <Francois.Bousquet_at_cgi.com>
Date: Fri Jul 15 2005 - 13:31:45 EDT
Using expect was the best solution for me because I didn't have the time to
try Amanda a free backup utility.

Here is the script I am using :

#!/usr/local/bin/expect -f
#
# Expect timing stuff
set force_conservative 0  ;# set to 1 to force conservative mode even if
                          ;# script wasn't run conservatively originally
if {$force_conservative} {
        set send_slow {1 .1}
        proc send {ignore arg} {
                sleep .1
                exp_send -s -- $arg
        }
}
#
#
# Calling ufsdump and mailing an alert for new tape need or backup dump
set timeout -1
spawn $env(SHELL)
match_max 100000
expect -exact "\$ "
send -- "/export/home/backup/backupAll.sh\r"
while {1} {
expect {
        "  DUMP: NEEDS ATTENTION" {
                exec /export/home/backup/mail.sh neednewtape
                exec sleep 300
                send -- "yes\r"
        }
        "  DUMP: END OF ALL BACKUPS" {
                exec /export/home/backup/mail.sh dumpdone
                exit
        }
}
}
expect eof








#!/bin/sh

SSH=/usr/local/bin/ssh
BACKUPUSER=backup
BASEDIR=/export/home/backup

# Rewind tape
sudo mt -f /dev/rmt/0 rewind

$SSH $BACKUPUSER@host1 << ENDSSH
./backup.sh
ENDSSH

$SSH $BACKUPUSER@host2 << ENDSSH
./backup.sh
ENDSSH

$SSH $BACKUPUSER@host3 << ENDSSH
./backup.sh
ENDSSH

# Local script for localhost
$BASEDIR/backup.sh

# Echo end of backup
echo "  DUMP: END OF ALL BACKUPS"



-----Original Message-----
From: Bousquet Francois [mailto:Francois.Bousquet@cgi.com] 
Sent: 11-Jul-05 2:52 PM
To: Mailing List - SunManagers (sunmanagers@sunmanagers.org)
Subject: ufsdump email alert ?

I have several server to backup on a centralized DLT 40/80 tape on a weekly
frequency.

I have create a script that is using sudo (for mt and ufsdump access) and
ssh private key authentication that execute a remove ufsdump from each
server to the centralized server with a tape.

Up to this point, it is working perfectly fine.

The problem is that the amount of data is getting bigger over time and I
have reach the maximum capacity of one tape so ufsdump is asking for a new
one.  That is not a problem when running in foreground with when running the
backup scrip with cron it is not funny !

I would like to find a way to alert me with a mail so I can change the tape
and continue the backup.

Is anyone here have done something like that before ?

Basically, I need to find a way to trap ufsdump output and send an email
when I getting a particular strings.

I also need to find a way to get the focus on a cronned process that is
running in the same way bash is doing it with it's jobs (bg & fg commands).

Frangois Bousquet
Unix System Administrator
Email : Francois.Bousquet@CGI.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Jul 15 13:34:27 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:49 EST