using python coding i want to make make the system to get sleep state , is that possible ? i need the solution in Ubuntu , i can find that for windows but for Ubuntu is their any solution ?
using python coding i want to make make the system to get sleep state , is that possible ? i need the solution in Ubuntu , i can find that for windows but for Ubuntu is their any solution ?
Using os.system you can call terminal commands. You can for instance use
systemctl hibernate
to get Ubuntu to sleep.Note: you might need to run your python file using
sudo
.