Get the latest tech news

How to trigger a command on Linux when power switches from AC to battery


In this blog post, you will learn how to trigger a command when a laptop is disconnected from power supply

If nothing happens, looks at systemd logs to see if something is wrong in udev, like a syntax error in the file you created or an incorrect path for the script. Lock user sessions Hibernate Proper shutdown Instant power off (through sysrq) Destroy LUKS master key to make LUKS volume unrecoverable + Instant power off While BusKill is an effective / unusual product that is certainly useful for a niche, protecting a running laptop against thieves is an extra layer when being outside.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Linux

Linux

Photo of power

power

Photo of command

command

Related news:

News photo

Apple SMC Driver Merged For Linux 6.17 To Be Able To Reboot Macs

News photo

Linux's Lockdown LSM Back To Being Maintained For Restricted Computing

News photo

Linux Begins Preparing For The Lenovo Legion Go 2 Handheld