I enabled suspend-then-hibernate but its not working all the time. When the system is not running code, if i press the power key then the system suspends for 10seconds(as i gave hibernate delay sec=10 in sleep.conf) then hibernates. I am running a python code with multiprocessing, during this time if I press the power button then system suspends for 10seconds, then pauses and again on suspend.
sleep.conf file:
[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendMode=
#SuspendState=mem standby freeze
HibernateMode=platform shutdown
HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
HibernateDelaySec=10
and did
"sudo ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /etc/systemd/system/systemd-suspend.service"
I also tried enabling Allowsuspend, AllowHibernation, giving the suspend mode in the sleep.conf file. Then i modified the logind.conf by enabling "HandlePowerKey=suspend-then-hibernate".
I converted my code to exe using pyinstaller. If I run as python code then this functionality works fine but if I run the exe it doesn't.
Can somebody please clarify this behaviour? Why doesn't it work when the code is running? I am using Intel 11th gen NuC and Ubuntu 20.