# auto shutdown on low battery?



## ksiu (Jun 19, 2021)

Hi,
Does  FreeBSD 12.2p7 automatically shutdown if the laptop battery is low?

If not, is there a way to make it do that?

I am running Thinkpad t440P.

Thanks!


----------



## Vull (Jun 19, 2021)

plasma5-plasma and mate power management widgets both have options to to shutdown automatically when power gets too low. There might be some other power management utility that doesn't require a desktop environment, but I don't know if there is, or what it is.


----------



## kpedersen (Jun 19, 2021)

I used to have a script that runs via cron every 5 mins, checks the remaining battery and suspends.

However many of my ThinkPads make so much noise when the battery is low that I simply didn't really need it.


----------



## ksiu (Jun 19, 2021)

kpedersen said:


> I used to have a script that runs via cron every 5 mins, checks the remaining battery and suspends.
> 
> However many of my ThinkPads make so much noise when the battery is low that I simply didn't really need it.



I have a script that checks battery every 60 seconds and display it on the status bar.  I am running DWM.

I guess I could use my script to command the laptop to sleep if, say, the battery is below 10%.

My script runs constantly in the background.  It sleeps for 60 seconds between battery checks.

I wonder if I should use cron instead of running my process constantly?   I don't know cron.  At work, the sys admin told us cron is not secure and banned us from using it.  So I never learn to use cron.


----------



## Tieks (Jun 19, 2021)

ksiu said:
			
		

> sys admin told us cron is not secure and banned us from using it


Did he say why he felt it was insecure? However, a script like yours could very well be started by cron, so you don't have to do it manually. It's not difficult either, see `man cron` and `man crontab`


----------



## Geezer (Jun 20, 2021)

sysutils/nut


----------

