From owner-freebsd-questions Thu Oct 18 12:37:41 2001 Delivered-To: freebsd-questions@freebsd.org Received: from wasp.eng.ufl.edu (wasp.eng.ufl.edu [128.227.116.1]) by hub.freebsd.org (Postfix) with ESMTP id CB05337B419 for ; Thu, 18 Oct 2001 12:37:37 -0700 (PDT) Received: from eng.ufl.edu (scanner.engnet.ufl.edu [128.227.152.221]) by wasp.eng.ufl.edu (8.9.3/8.9.3) with ESMTP id PAA06060; Thu, 18 Oct 2001 15:37:33 -0400 (EDT) Message-ID: <3BCF2F7B.A5B40B2D@eng.ufl.edu> Date: Thu, 18 Oct 2001 15:37:31 -0400 From: Bob Johnson X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en, eo MIME-Version: 1.0 To: questions@freebsd.org Subject: How to auto-execute script AFTER shutdown? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I've installed NUT with the genericups driver to monitor my APC Back-UPS. In order to cleanly power down the system, I need to be able to do the following: - when time comes to power down the system, shut down to single user mode so (as much as possible) all processes are cleanly terminated and various buffers are flushed. - after shutdown is complete and the system is in single user mode, issue a shutdown command to the UPS so it turns off power. - finally, pause a while then issue a reboot command. This is so that if power returns just as the UPS is shutting down, thus aborting the shutdown, the system will return to normal operation. If the UPS succeeds in shutting down, the reboot command will never be issued. I can't find any hooks that will let me execute a script after shutting down to single user mode. rc.shutdown appears to execute just _before_ shutdown, to allow custom cleanup. Is there some way to accomplish this? It would be neat if there were a specific file name that gets executed in single user mode when you shut down from multi-user mode. - Bob To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message