russrao
deepin
2019-06-01 05:36 #!/bin/bash
#check existing power status, whether cable is unplugged
while true;do
p1=`tlp-stat -s | tail -n 3 |awk -F '=' '{print $2}'`
mode=`echo $p1 | awk -F ' ' '{print $1}'`
pwr=`echo $p1 | awk -F ' ' '{print $2}'`
if [ $mode != $pwr ]
then
sudo tlp start > /dev/null
sudo systemctl restart upower.service
fi
sleep 2
done
#check existing power status, whether cable is unplugged
while true;do
p1=`tlp-stat -s | tail -n 3 |awk -F '=' '{print $2}'`
mode=`echo $p1 | awk -F ' ' '{print $1}'`
pwr=`echo $p1 | awk -F ' ' '{print $2}'`
if [ $mode != $pwr ]
then
sudo tlp start > /dev/null
sudo systemctl restart upower.service
fi
sleep 2
done
Reply Like 0 View the author


中文 
