battery-charge-thresholds.service 520 B

1234567891011121314
  1. [Unit]
  2. Description=Set battery charge thresholds
  3. After=multi-user.target
  4. StartLimitBurst=0
  5. [Service]
  6. Type=oneshot
  7. Restart=on-failure
  8. RemainAfterExit=yes
  9. ExecStart=/bin/bash -c 'echo 80 > /sys/class/power_supply/BAT0/charge_control_start_threshold; echo 90 > /sys/class/power_supply/BAT0/charge_control_end_threshold'
  10. ExecStop=/bin/bash -c 'echo 100 > /sys/class/power_supply/BAT0/charge_control_end_threshold; echo 99 > /sys/class/power_supply/BAT0/charge_control_start_threshold'
  11. [Install]
  12. WantedBy=multi-user.target