1. install xprintidle
sudo apt-get install xprintidle
2. buat file .shutdown.sh
copykan
#!/bin/bash
idletime=$((1000*60*60*2)) # 2 hours in milliseconds
while true; do
idle=`xprintidle`
echo $idle
if (( $idle > $idletime )); then
#sudo shutdown -P now
dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true
fi
sleep 1
done
3. chmod +x .shutdown.sh
4. add to start up
5. bash /home/debian/.shutdown.sh