Ubuntu 20.04 disable sleep

I installed the server version, but added xfce4 since I’m not 100% cli capable, and sometimes I’ll want to use it as a desktop.

I did the sshd_config thingy, but I guess this will only work as long as I’m connected via ssh? There will be times when I want it to run a long python program (~2h) without being connected via ssh or screen the whole time, will it also work then?

I looked in the config tools of xfce but couldn’t find any power management settings…

I found this online but I’m not sure if this will do the trick:

This command disables suspend:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

and this command brings it back:

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
1 Like