Last active
July 5, 2022 08:46
-
-
Save ps1dr3x/747a391a43bf1caf88a3a7ee23d6db4d to your computer and use it in GitHub Desktop.
systemd service to set a charge limit for the laptop's battery (when supported)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Set the battery charge threshold | |
After=multi-user.target | |
StartLimitBurst=3 | |
StartLimitIntervalSec=300s | |
[Service] | |
Type=oneshot | |
Restart=on-failure | |
ExecStart=/bin/bash -c 'echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold' | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment