Boot & Shutdown Notebook on Power Connection & Loss-is this possible? (Xubuntu)
Long version:
I have xubuntu installed to a laptop. This system needs to shut down when AC power is disconnected. I don't know of a setting manager that is able to configure this. If there is one, I'd love to know of it. Ideally, the system should shut down a minute or two after power is lost. I am also trying to get the laptop to boot when it is plugged in. Booting isn't AS much of a problem, because it can be solved with a little WOL, but it would be a much smoother operation if it could bring it's self up too. I can't use WOL to shut the box down because the router will have lost power at the same time as the system. Short version: How can I set up a distro installed to a laptop to boot and shut down when power is connected, and disconnected, respectively. Thanks -Spence |
You need BIOS/hardware support to automatically boot whenever AC power is connected. The OS, be it Linux or whatever else, cannot help you with that. So, check your BIOS or equivalent. If your laptop BIOS or equivalent does not provide that option, hardware modification is possible, but will void any warranties, so I would not recommend it unless you are a DIY person.
The timed poweroff after loss of AC power should be easy. Since you use Xubuntu, and therefore XFCE, you should already have xfce4-power-manager in your panel; if not, install it. Right-click on the icon, and select Preferences. In the Battery section, select 'Shutdown' for 'When battery power is critical'. In the Extended section, select say 90% for 'Consider the computer on low power at'. Since AC power equates to about 100%, your laptop should now automatically power down after a short while. This obviously works only if you are logged on, and only for you personally. _________________________________________________ In general, most Linux laptops run acpid, a daemon which provides ACPI events (like AC connect and disconnect, lid events) to userspace programs. Its configuration varies a bit between Linux distributions, but in general, it is configured via a set of simple shell scripts under /etc/acpi/. If you cannot or do not want to rely on the xfce4-power-manager stuff, for example because you want the laptop to power off even from e.g. the login screen, you can use the acpid interface instead. First, you need a small shell script to do the timed shutdown. We'll later on tell acpid to run it whenever AC power is lost. The script must wait for the specified duration, and keep checking if AC power is regained. If AC power is regained during this interval, the script must of course exit (and not shutdown the laptop). Short AC losses are surprisingly common. So, assume you save this as /usr/local/bin/ac-loss-shutdown.bash: Code:
#!/bin/bash Code:
# /etc/acpi/events/battery Code:
#!/bin/bash I hope you find this instructive, |
Quote:
Quote:
Edit: Upon further inspection, I can not set the "critical level" above 20%. Any time I try to set it 21% or more, it goes to the default 20%. |
All times are GMT -5. The time now is 09:43 AM. |