From owner-freebsd-questions@freebsd.org Fri Dec 7 07:36:04 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5967132D13F for ; Fri, 7 Dec 2018 07:36:03 +0000 (UTC) (envelope-from matthias@petermann-it.de) Received: from mail.d2ux.org (d2ux.org [148.251.193.221]) by mx1.freebsd.org (Postfix) with ESMTP id 27BEC7B484 for ; Fri, 7 Dec 2018 07:36:02 +0000 (UTC) (envelope-from matthias@petermann-it.de) Received: from mail (unknown [10.0.0.3]) by mail.d2ux.org (Postfix) with ESMTP id AC64D5D069 for ; Fri, 7 Dec 2018 08:35:55 +0100 (CET) X-Virus-Scanned: amavisd-new at petermann-it.de Received: from mail.d2ux.org ([10.0.0.3]) by mail (new.petermann-it.de [10.0.0.3]) (amavisd-new, port 10024) with ESMTP id lKMoWE-Lp6v0 for ; Fri, 7 Dec 2018 08:35:55 +0100 (CET) Received: from [192.168.2.134] (p5B2F3726.dip0.t-ipconnect.de [91.47.55.38]) by mail.d2ux.org (Postfix) with ESMTPSA id ECA9A5D05A for ; Fri, 7 Dec 2018 08:35:54 +0100 (CET) From: Matthias Petermann To: freebsd-questions Subject: /sbin/dump: instant exit in case of disk full (instead of prompting for next volume) Message-ID: <6116a4e5-34d1-3823-dd5e-28c784083cf2@petermann-it.de> Date: Fri, 7 Dec 2018 08:35:10 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 27BEC7B484 X-Spamd-Result: default: False [-3.99 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:148.251.193.221/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[petermann-it.de]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[mail.petermann-it.de]; NEURAL_HAM_SHORT(-0.79)[-0.786,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; IP_SCORE(-1.00)[ipnet: 148.251.0.0/16(-2.51), asn: 24940(-2.47), country: DE(-0.01)]; ASN(0.00)[asn:24940, ipnet:148.251.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 07:36:04 -0000 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 | www.petermann-it.de GnuPG: 0x5C3E6D75 | 5930 86EF 7965 2BBA 6572 C3D7 7B1D A3C3 5C3E 6D75