Adding a hook to shutdown.c & halt (reboot.c) to call a script.

Julian H. Stacey jhs at berklix.com
Fri Jul 5 12:52:19 UTC 2013


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.


More information about the freebsd-mobile mailing list