Prevent Ubuntu 12.04 from going to sleep



I installed PMS on Ubuntu 12.04, everything is working perfectly but I have a problem I cannot fix (after hours of searching), the fact that I want my Ubuntu server to go to sleep after an hour, so far so good, but when I use a Plex client, Ubuntu doesn't recognize that as activity and It's going to sleep in the middle of a movie watching session.

Can somebody help me find a solution to prevent Ubuntu from going to sleep when there is activity on a samba share?

Thank you


It's likely that "sleep prevention" hasn't been implemented for Linux yet, we'll get to it in a future release.


Wow! quick answer! Thank you Elan! and always loved Plex by the way, It's installed everywhere around the house, Ipad, Iphone, Apple TV 2, Mini Mac and iMac!

I understand that this is something that can be add to PMS in the future and I appreciate that (let's hope parental control will be there too! ;-)) but are you telling me that you think there is no possible in Ubuntu, with a script maybe, to fix that?

Actually I'm not a linux expert so I will take your word for it believe me!

Thanks again


Sorry to drag up an old thread, but was sleep prevention ever implemented for Linux? I couldn’t find any subsequent reference to this. Thanks.


Sleep prevention? Simply turn off power management and your system will not sleep.

If you are referring to PMS not letting the host go to sleep, it does not operate that way. PMS routinely runs tasks in the background and writes to the log files. These activities require the disks be spinning.


@ChuckPA said:
Sleep prevention? Simply turn off power management and your system will not sleep.

Energy consumption is a priority in my home, and although I built my system to be highly efficient, it goes against my grain to leave it on 24/7. As it stands now, whenever my wife wants to watch a Plex movie on Roku, she has to find me (or wake me up) if I’m not at my desk so I can turn off power management (she’s intimidated by my computer). It would be great if she could just hit the space bar to wake it up, then Plex would keep it awake as long as it’s serving content.

If you are referring to PMS not letting the host go to sleep, it does not operate that way.

I don’t understand how to reconcile that with Elan’s response. It seems reasonable that it could operate that way and his comment certainly indicates that was the intention, at least in 2012.


It’s a 5 year old statement. Back then, yes it was possible. Since then , No.

If you want the system to sleep and be woken by the spacebar, your only viable means is Windows. Linux isn’t going to do it for you.


Not what I wanted to hear, but I always appreciate clarity. Thanks!

I’m new to Linux, but I imagine I can use a script in LInux, triggered by a desktop widget, that would reset the power management scheme.


If you’re new to Linux, I very strongly update. Ubuntu 12 is ancient. Ubuntu 16 is extremely popular and stable. Ubuntu 17 is new and has a few kinks in it.

I don’t know how much longer Ubuntu 12 can be supported (run time library age becomes problematic) . It’s already 5 years old.


The original poster mentioned Ubuntu 12.04, but when posted, that was latest version. I’m running 16.04 (Mint 18.2/Xfce, Z270/7700K/32GB/SSD). Still finding my way around, though.

I understood the learning curve would be steep, which is why I put it off for so long. But I’m done with Windows. Until a couple of months ago (and still working along side my new machine for now), I’ve been using a tweaked out XP machine I built in 2008 using then-2-year old components. It still works great except for browsing, and PMS v0.9.9 where transcoding for some videos pushes the Operon 185 dual core to 100%, occasionally halting playback and throwing an error.


with an i7-7700, you’re all set for full hardware transcoding with HEVC HDR capability. That’s a nice big toy :slight_smile:

I used to have Opterons (two big Opteron 848 boxes). Great math crunchers but not the best at video.

The learning curve for Linux will be steep. You’ll find it’s often easier to do work at the command line but is transitioning to GUI as time passes.