I would like to preserve the battery on my laptop by limiting how much it gets charged.
There is a file (/sys/devices/platform/lg-laptop/battery_care_limit) with a value of 100.
I can run command
echo '80' | sudo tee /sys/devices/platform/lg-laptop/battery_care_limit
I have to run this command at every reboot.
I have tried adding it via crontab -e but it doesn't work.
How do I get this command to run automatically at every reboot?
Additional information posted as an answer
thanks for the reply.
This works:
@reboot echo 80 > /home/myuser/test.txt
Tried and failed all the following:
@reboot echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit
@reboot sudo echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit
@reboot sleep 60 && echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit
@reboot sleep 60 && sudo echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit
At least the command is being attempted.
journalctl -b | grep echo
returns:
CRON[1041]: (myuser) CMD (sudo echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit)
CRON[1045]: (myuser) CMD (sleep 60 && sudo echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit)