[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: initscripts



Not exactly elegant, but it should get the job done.  By which I mean
that I haven't tested it, but it looks convincing:

#!/bin/sh

MODPROBE=/sbin/modprobe

case "$1" in
	stop)
	 echo "Powering Down...";
	 $MODPROBE apm power_off=1;
	;;
	*)
	echo "Usage: /etc/init.d/powerdown stop"
	exit 1
esac
exit 0

Just throw it into /etc/init.d/powerdown and symlink it appropriately.

~Tom White

---------------------------------------------
http://www.oddquad.org/
---------------------------------------------
It is equally bad when one speeds on the guest unwilling to go, and when he
holds back one who is hastening.  Rather one should befriend the guest who
is there, but speed him when he wishes.
		-- Homer, "The Odyssey"

	[Quoted in "VMS Internals and Data Structures", V4.4, when
	 referring to scheduling.]

On Mon, 28 Jul 2003, Peter Hugosson-Miller wrote:

> Date: Mon, 28 Jul 2003 10:38:14 +0200
> From: Peter Hugosson-Miller <pehu@im.se>
> To: Debian User <debian-user@lists.debian.org>
> Subject: initscripts
> Resent-Date: Mon, 28 Jul 2003 03:38:32 -0500 (CDT)
> Resent-From: debian-user@lists.debian.org
>
> Still no responses to my apm question (
> http://lists.debian.org/debian-user/2003/debian-user-200307/msg03355.html
> ), so I've started investigating a bit, to see if I can figure this out
> for myself.
>
> I have found the following page that describes, amoung other things, the
> initscripts that are run when changing runlevels:
> http://www.debian.org/doc/debian-policy/ch-opersys.html and I think I am
> in the right area. Trouble is, this seems to be more aimed at package
> maintainers, so that packages that add initscripts do so in "the right
> way" for debian.
>
> Still, what I have come up with is the following:
>
> 1) I need to write a script that when it receives the argument "stop"
> will do a "modprobe apm power_off=1".
> 2) The script needs to live in /etc/rc0.d, or somewhere else but be
> symlinked there.
> 3) The script needs to be called Sxxloadapm, where xx is a suitably high
> number so that gdm has already been stopped (I chose this, as in rc0.d,
> "S" scripts are still run after "K" ones, but with the parameter "stop",
> so it seems safer).
>
> I'm afraid that's as good as I can do by myself, so would anyone be so
> kind as to do the final polishing for me (that includes suggestions as
> to the script itself - I've never written one of these before, and I
> find the existing ones hard to follow).
>
> I would also like to make sure that this is done in the nicest way, i.e.
> not too hacky. The whole thing is a bit of a hack, I know, but I can't
> see any other way to make this work.
>
> Thanks in advance.
>
> --
> Cheers,
>
>    .~.
>    /V\
>   // \\
>  /(   )\
>   ^`~´^
> < hugge >
>
>
>
> --
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>



Reply to: