
Came across this rather interesting reader comment <https://forums.theregister.com/forum/all/2022/02/18/something_for_the_weekend/#c_4417057> about (supposedly) prolonging the life of your laptop battery by reducing the limit to which it is charged. This is configured by creating a systemd service file (called, for example, /etc/systemd/system/battery-charge-threshold.service) that automatically sets the threshold at boot time. Its contents are [Unit] Description=Set the battery charge threshold After=multi-user.target StartLimitBurst=0 [Service] Type=oneshot Restart=on-failure ExecStart=/bin/bash -c 'echo 50 > /sys/class/power_supply/BAT0/charge_control_end_threshold' [Install] WantedBy=multi-user.target You then use the usual “systemctl start” command to invoke this immediately, plus “systemctl enable” to ensure it runs at every subsequent boot. Regardless of whether it actually prolongs the life of your battery (try at your own risk!), it shows how easy it is to customize aspects of your system behaviour with systemd. As of this writing, that comment has garnered 7 upvotes and no downvotes, on a site where the readers are notorious for being a nest of systemd-haters.