From owner-freebsd-virtualization@freebsd.org Thu Apr 25 15:04:09 2019 Return-Path: Delivered-To: freebsd-virtualization@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 114471599AE9 for ; Thu, 25 Apr 2019 15:04:09 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from admin.sibptus.ru (admin.sibptus.ru [IPv6:2001:19f0:5001:21dc::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73C24894C1 for ; Thu, 25 Apr 2019 15:04:08 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=GqCt5V1ObCbEWntKSvPdck5STH32mQ79WR5SRJZkPK0=; b=dXp1jGMpglH7gugZvDUMzerBEP vjx0xrVpAqNkHYG/szi5xHjaiqXlLPYSBMvF9Pc4glt2TeWgVt3d58drUiz9ofB7ghRUJp4hj5lZa 8iY4l1CLGfMuRFt6SGl6MDL/HPj/rISK6WJRyFhuSpWdToeStVMEwAINEVUHEoKETXRQ=; Received: from vas by admin.sibptus.ru with local (Exim 4.92 (FreeBSD)) (envelope-from ) id 1hJfux-000GGZ-Kq for freebsd-virtualization@freebsd.org; Thu, 25 Apr 2019 22:04:07 +0700 Date: Thu, 25 Apr 2019 22:04:07 +0700 From: Victor Sudakov To: freebsd-virtualization@freebsd.org Subject: Re: [vm-bhyve] Windows 2012 and 2016 servers guests would not stop Message-ID: <20190425150407.GA62313@admin.sibptus.ru> References: <20190424043656.GA25754@admin.sibptus.ru> <201904240557.x3O5v6AK041737@gndrsh.dnsmgr.net> <20190424065223.GA28138@admin.sibptus.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="envbJBWh7q8WU6mo" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://www.dreamwidth.org/pubkey?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.11.4 (2019-03-13) Sender: Victor Sudakov X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Apr 2019 15:04:09 -0000 --envbJBWh7q8WU6mo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Stephen Stuart wrote: > I call this in /etc/rc.shutdown.local to shut all VMs down gracefully and > wait, perhaps a variant would help you. >=20 > #!/bin/sh >=20 > INTERVAL=3D5 > /usr/bin/killall -TERM bhyve > echo -n "/dev/vmm:" > while test -d /dev/vmm ; do > echo -n "" $(/bin/ls /dev/vmm | /usr/bin/wc -w) > /bin/sleep $INTERVAL > done > echo " 0" Thanks for reminding me about /etc/rc.shutdown.local. I've tested a solution today and it seems working. 1. Start apcupsd with --term-on-powerfail apcupsd_enable=3D"YES" apcupsd_flags=3D"--term-on-powerfail" 2. Put the following line into /etc/rc.shutdown.local test -f /var/run/powerfail && /usr/local/sbin/apcupsd --killpower Now, when the UPS power is exhausted, apcupsd starts the shutdown procedure and exits. The system shuts down without any haste, as it pleases, and at the very end "apcupsd --killpower" is called and poweroffs the UPS. --=20 Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/ --envbJBWh7q8WU6mo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJcwcxnAAoJEA2k8lmbXsY0BE8H/3qJrBBNaXzlOXsL99eLmBWT /MCKBJa0+l2AueDgNyO3YWa4aKGtYwQJI4PrZDme9QAGv8Ijs1xXvgdCanfaquF9 HRSoC0wAy19lASkIW82xt+TVz4iyFtrlMBWrlr14rTrvxjWb6cMfct5jW66Iykhb WSHd8auLweqkkc1damoE2lRKKVJbuWEUHLn7JZoTc/C3Gwlrwijo3iDPUX+UyWM5 F3IC3Mri/zRhvbwEuqx5kNdc72sztpCN7Gc/yvzqh/Wq7EJXrRY0HKE8VPfohEF8 /P0hlZOasraYaGAoWnlHd6Nc7QmFs6SoSm/2smsVFEhe+M0//y7TTuOuE10fTUw= =p07H -----END PGP SIGNATURE----- --envbJBWh7q8WU6mo--