Anyway to set a timer to suspend the system say in 120 minutes similar to doing:
$ shutdown 120
But for suspension. I want to encode some stuff in handbrake and I want my pc to automatically go to sleep after so much time.
You can use at
to schedule any action.
Firstly, you have to install at
:
sudo pacman -S at
# or
sudo apt install at
Then, start service at
:
systemctl start atd
And now you can do something like that:
echo 'pmi action suspend' | at 4pm
Or like that:
echo pm-suspend | sudo at now + 10 min
sleep 120m && systemctl suspend
? Unless you want to usesystemd-inhibit
(as suggested here)...sudo sh -c 'sleep 120m && systemctl suspend'
. The screen lock seems to revoke your console permissions.