/sbin/dump: instant exit in case of disk full (instead of prompting for next volume)
Matthias Petermann
matthias at petermann-it.de
Fri Dec 7 07:36:04 UTC 2018
Hello,
I am using dump(8) to backup local filesystems to an USB drive. Is there
an easy way to non-interactively exit dump in case of target disk full
error?
Currently it issues two prompts:
DUMP: Is the new volume mounted and ready to go?: ("yes" or "no") no
DUMP: Do you want to abort?: ("yes" or "no") yes
before it exits with code 3, which I need for my wrapping shell script
to properly react. I would like to have it exit immediately in this
case, without further interaction.
One way I explored was by using expect (script below), but I rather
would use exclusively tools from base and don't want to add extra
complexity to my backup script.
In case there is no easy way currently, would it make sense to enhance
dump to provide an option for non interactive mode?
Kind regards,
Matthias
#!/usr/bin/env expect
set timeout 43200
set result 0
spawn /sbin/dump -C16 -b64 -0au -h0 -f /mnt/test.dump /
expect {
eof {
exit $result
}
timeout {
exit 1
}
"*DUMP: Is the new volume mounted and ready to go?:*" {
send "no\r"
}
}
expect {
eof {
exit $result
}
timeout {
exit 1
}
"*DUMP: Do you want to abort?:*" {
send "yes\r"
set result 3
}
}
expect {
eof {
exit $result
}
timeout {
exit 1
}
}
--
Matthias Petermann <matthias at petermann-it.de> | www.petermann-it.de
GnuPG: 0x5C3E6D75 | 5930 86EF 7965 2BBA 6572 C3D7 7B1D A3C3 5C3E 6D75
More information about the freebsd-questions
mailing list