John Hasler wrote:
To run these enhanced initscripts you need something like the current runlevel system.Perhaps you could use the runlevel system itself. There are plenty of unused levels.
Doesn't switching runlevels involve stopping all running services from the previous runlevel and then restarting them in the new runlevel? I wouldn't want the thing to stop and restart my X server when I pull the AC plug. I _would_ like a system that would allow me to stop part of my services when on AC, integrated with the current init.d system. A sort of sub-runlevel, or "runlevel adaptation" layer. This could be done using links:
/etc/powermgmt/bat-only.d/ laptop-mode -> ../../init.d/laptop-mode /etc/powermgmt/ac-only.d/ ssh -> ../../init.d/ssh fetchmail -> ../../init.d/ssh (etc)The meaning of this would be that some services would only be started when in AC mode, and some only when in battery mode. Switching between the modes involves stopping the services listed in one mode and starting those in the other. These services should be removed from the actual runlevel directory (/etc/rc2.d) and replaced by a special service (/etc/init.d/powerlevel or something) that would start these appropriate sublevel services.
--Bart