SUMMARY: vdump & expect backup scripts

From: Smith, Lawrie <Lawrie.Smith_at_capita.co.uk>
Date: Fri, 11 Jan 2002 11:20:45 +0000

Many thanks to Jenny Butler [jbutler_at_utmem.edu]


Lawrie,
    I haven't seen any feedback on the list and didn't know if you
had solved your problem with expect and backups. I finally
took this week to wrestle the issue into submission. Below is
a very simple example for what it's worth. Maybe this will
help you some.
    If you discover any neat tricks, please share!
                        Good luck, Jenny

Here are three files (below) -
> the first is the korn shell script that I ran from cron to do a backup,
the
> second is the expect script that it calls, and the last is the composite
log
> of what happened. Notice that I did use an argument for the file system
> to backup. Again, just a starting point that maybe will help you a
little.
>
> #! /usr/bin/ksh
> # test-user: script to do test backup using expect script
> #
> print "Starting backup script $(/bin/date)" >
> /usr/users/backups/test-expect.log
> #
> /usr/users/backups/test-expect.exp var
> /bin/cat /usr/users/backups/test-file.log >>
> /usr/users/backups/test-expect.log
> #
> print "Finished expect script $(/bin/date)" >>
> /usr/users/backups/test-expect.log
> #
> print "Rewinding tape now $(/bin/date)" >>
> /usr/users/backups/test-expect.log
> /sbin/mt -f /dev/ntape/tape0_d1 rewind
> print "Sleeping now $(/bin/date)" >> /usr/users/backups/test-expect.log
> /sbin/sleep 120
> print "Unloading tape now $(/bin/date)" >>
> /usr/users/backups/test-expect.log
> /sbin/mt -f /dev/ntape/tape0_d1 unload
> print "Completely done now $(/bin/date)" >>
> /usr/users/backups/test-expect.log
> #
>
>
> #!/usr/local/bin/expect -f
> # This expect script should be run a test backup script
> # Modified to pass what to back up in first argument
> #
> set timeout -1
> spawn $env(SHELL)
> match_max 100000
> log_file /usr/users/backups/test-file.log
> send_log "starting expect part now - [exec date] \r\n"
> #
> set mdir [lindex $argv 0]
> send_log "[lindex $argv 0] is the directory \r\n"
> send_log "begin vdump process - [exec date]...\r\n"
> #
> send -- "/sbin/vdump -1 -NU -f /dev/ntape/tape0_d1 /$mdir\r"
> while {1} {
> expect {
> -re "(vdump: Dump completed)" {
> send_log "finished vdump - [exec date]...\r\n"
> exit 0
> }
> -re "(vdump: unable to write to device)" {
> send -- "no\r"
> expect eof
> exit 1
> }
> default {
> exp_continue
> }
> }
> }
> #
>
>
> # cat test-expect.log
> Starting backup script Thu Jan 10 15:10:00 CST 2002
> starting expect part now - Thu Jan 10 15:10:01 CST 2002
> var is the directory
> begin vdump process - Thu Jan 10 15:10:01 CST 2002...
> # /sbin/vdump -1 -NU -f /dev/ntape/tape0_d1 /var
> /sbin/vdump -1 -NU -f /dev/ntape/tape0_d1 /var
> path : /var
> dev/fset : cluster_var#var
> type : advfs
> advfs id : 0x3a8ae1ae.00018b2b.1
> Wed Jan 9 08:01:49 2002
> vdump: Date of last level 1 dump: Wed Jan 9 08:01:49 2002
> vdump: Dumping directories
> vdump: Dumping 56306700 bytes, 717 directories, 212 files
> vdump: Dumping regular files
>
> vdump: Status at Thu Jan 10 15:10:51 2002
> vdump: Dumped 56328237 of 56306700 bytes; 100.0% completed
> vdump: Dumped 717 of 717 directories; 100.0% completed
> vdump: Dumped 216 of 212 files; 101.9% completed
> vdump: Dump completed at Thu Jan 10 15:10:51 2002
> finished vdump - Thu Jan 10 15:10:51 CST 2002...
> Finished expect script Thu Jan 10 15:10:51 CST 2002
> Rewinding tape now Thu Jan 10 15:10:51 CST 2002
> Sleeping now Thu Jan 10 15:11:01 CST 2002
> Unloading tape now Thu Jan 10 15:13:01 CST 2002
> Completely done now Thu Jan 10 15:14:56 CST 2002
>
>

Kind regards

Lawrie Smith
Capita Technical Services
West Malling

email: lawrie.smith_at_capita.co.uk
Tel: 01732 877266



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************
Received on Fri Jan 11 2002 - 11:31:51 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT