Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- newState=$1
- startFile="/sys/class/power_supply/BAT0/charge_start_threshold"
- stopFile="/sys/class/power_supply/BAT0/charge_stop_threshold"
- if [ $newState == "help" ]
- then
- echo "full 0-100 ; desk 45-50 ; daily 75-80"
- fi
- if [ $newState == "full" ]
- then
- echo 0 | sudo tee $startFile
- echo 100 | sudo tee $stopFile
- fi
- if [ $newState == "desk" ]
- then
- echo 45 | sudo tee $startFile
- echo 50 | sudo tee $stopFile
- fi
- if [ $newState == "daily" ]
- then
- echo 75 | sudo tee $startFile
- echo 80 | sudo tee $stopFile
- fi
- echo "start threshold is set to $(cat $startFile)"
- echo "stop threshold is set to $(cat $stopFile)"
Advertisement
Add Comment
Please, Sign In to add comment