From owner-freebsd-mobile@FreeBSD.ORG Fri Jul 5 12:52:19 2013 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 66096E91 for ; Fri, 5 Jul 2013 12:52:19 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from slim.berklix.org (slim.berklix.org [94.185.90.68]) by mx1.freebsd.org (Postfix) with ESMTP id EFAA91B84 for ; Fri, 5 Jul 2013 12:52:18 +0000 (UTC) Received: from park.js.berklix.net (p5DCBE79D.dip0.t-ipconnect.de [93.203.231.157]) (authenticated bits=128) by slim.berklix.org (8.14.5/8.14.5) with ESMTP id r65CqAnB053186; Fri, 5 Jul 2013 14:52:10 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.14.3/8.14.3) with ESMTP id r65CqGcP092814; Fri, 5 Jul 2013 14:52:16 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id r65Cq46b046582; Fri, 5 Jul 2013 14:52:10 +0200 (CEST) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201307051252.r65Cq46b046582@fire.js.berklix.net> To: freebsd-mobile@freebsd.org Subject: Adding a hook to shutdown.c & halt (reboot.c) to call a script. From: "Julian H. Stacey" Organization: http://berklix.com BSD Linux Unix Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com/~jhs/cv/ Date: Fri, 05 Jul 2013 14:52:04 +0200 Sender: jhs@berklix.com Cc: "Julian H. Stacey" X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jul 2013 12:52:19 -0000 Hi mobile@ I need ** my laptop to call a script before shutdown, (perhaps automaticaly too with something like 'test -e ` etc, though perhaps the default should remain with no test) I dont see any hooks in man shutdown or halt ? I could hack /usr/src/sbin/shutdown/shutdown.c & /usr/src/sbin/reboot/reboot.c # (source of halt) or does someone have a better idea ? FreeBSD has a mass of scripts etc for system start up, but seems light on close down hooks ? I seem to recall on system 5 there were table entries for up & down for lots of things, (though I never got on with 5, not lots of others here either, & am not advocating that route), but is there a better way than adding a hook to system("/some_path"); ? BTW ** What I'm calling manually before halt is my http://www.berklix.com/~jhs/bin/.sh/umountusb A combo of umounts of USB sticks/disks with plain dos & ufs + also mdconfig -d & gbde detach for encrypted file system on both hard disk & USB sticks. (When I forget to call it before halt, the laptop hangs on USB.) Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultant, Munich http://berklix.com Reply below not above, like a play script. Indent old text with "> ". Send plain text. No quoted-printable, HTML, base64, multipart/alternative.