[SOLVED] Don't sleep while Plex is streaming?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
milon
Level 2
Level 2
Posts: 78
Joined: Thu Jan 10, 2019 3:20 pm

[SOLVED] Don't sleep while Plex is streaming?

Post by milon »

I'm running Linux Mint 19.1 with Cinnamon, and I'm still new-ish to it (migrating from Windows). I'm running a Plex server on the computer, and the computer goes into sleep mode (suspend) while watching movies etc.

Is there any way to prevent it from sleeping while Plex is actively streaming something? What diagnostic info would be helpful?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Don't sleep while Plex is streaming?

Post by lsemmens »

The answer is yes, you can stop it from sleeping, but....I am not home at the moment so cannot recall how I did it. Have a look through your power settings on your OS as well as the settings in Plex.
Fully mint Household
Out of my mind - please leave a message
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Don't sleep while Plex is streaming?

Post by phd21 »

Hi milon,

+1 for "lsemmens" remarks. Check your Plex settings for an option to prevent system from going to sleep. Also check power saving and screensaver (screen locker) settings.

There are also some applications that can prevent the computer from going to sleep or the screensaver from starting like "Caffeine" and "Inhibit Applet".

Keep Ubuntu Awake with Caffeine (And Avoid That Pesky Lock Screen) - OMG! Ubuntu!
https://www.omgubuntu.co.uk/2016/07/caf ... ock-screen

Caffeine - prevent the screensaver and the "sleep" mode
https://mintguide.org/tools/815-caffein ... -mode.html

To install this using the PPA method, open a console terminal, type in, or copy & paste, each line below one by one: Click "Select All" above command, right click the highlighted command, select Copy (or Ctrl+Insert), click in the console terminal window, and right click paste ("Shift+Insert" or "Ctrl+Shift+v"), repeat for each command.

Code: Select all

sudo add-apt-repository ppa:caffeine-developers/ppa

Code: Select all

sudo apt-get update

Code: Select all

sudo apt install caffeine

Wakefull - screensaver and powersaver blocker (like caffeine)
https://mintguide.org/tools/586-wakeful ... ocker.html


linux - Prevent system from going to sleep/suspend - how Xviewer/VLC do it - Unix & Linux Stack Exchange
https://unix.stackexchange.com/question ... -vlc-do-it

Hope this helps ...
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
milon
Level 2
Level 2
Posts: 78
Joined: Thu Jan 10, 2019 3:20 pm

Re: Don't sleep while Plex is streaming?

Post by milon »

@lsemmens:
Plex - didn't find anything relevant in any of the settings pages
Power Management - Just lets me set when to turn off the screen, when to suspend the system, and what to do when the power button is pressed

@phd21:
I'll have a look into the packages you listed.

Thanks for the fast replies!
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Don't sleep while Plex is streaming?

Post by phd21 »

Hi milon,

You are welcome from all of us that replied...

What's nice about Caffeine is that you can leave your current power saving and screen saving settings the way they are and use Caffeine to stop sleep or screen saving when you want to like when watching something on Plex.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
milon
Level 2
Level 2
Posts: 78
Joined: Thu Jan 10, 2019 3:20 pm

Re: Don't sleep while Plex is streaming?

Post by milon »

Unless I'm missing something, that's not the solution I'm looking for.

I'm looking for something that will automatically prevent Suspend, without needing user interaction. The reason for this is that this PC (my Plex server) is in my study, and I stream Plex to my TV in the living room. (If it matters, the Plex client is a RasperryPi running OSMC/Kodi). To watch something on Plex, I have to go back to the Plex PC and set Suspend to Never, then go back to the living room, watch the movie or whatever, then go back to the study afterwards and re-enable Suspend. Caffeine and wakeful have to be manually controlled, so I'd still be making 2 trips to the study - it's a slightly different process, but doesn't enable me to be as lazy as I'd like. :lol:

And in case you're wondering, I don't think my WiFi card supports wake-on-lan. My hacky work around for that is the wireless USB mouse in the living room - its receiver is plugged into the server in the study and I just wiggle the mouse to wake the system.

EDIT - I've tried following the process listed by these two links, but it only returns "401 Unauthorized" so of course it fails.
https://www.collindelker.com/2015/07/12 ... sleep.html
https://www.collindelker.com/2016/10/16 ... take2.html
(I also get "401 Unauthorized" when I navigate to "localhost:32400/status/sessions" using Firefox, which is logged in to my local Plex setup, so I doubt it's a permissions issue.)
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Don't sleep while Plex is streaming?

Post by phd21 »

Hi milon,

Okay, then on the Plex server computer which I assume is running Linux Mint turn off or disable the power settings for sleep and screen energy saving and click apply / ok, and then turn off or disable the screensaver (set to never). If you are using WiFi on the Plex Server computer, then also turn off or disable any WiFi power saving functions.

Hope this helps ...
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
ajgreeny
Level 7
Level 7
Posts: 1662
Joined: Mon Nov 19, 2007 3:27 pm

Re: Don't sleep while Plex is streaming?

Post by ajgreeny »

On my desktop machine using Xubuntu 18.04 which I also use as a Plexmediaserver I have in my panel one of the applets that with a right click offers me a Presentation Mode tick-box. I can not get to that machine at present so I'm not completely certain what applet provides this option.

If I enable that option the machine does not go into suspend mode unless I put it there manually, so we can watch several movies if we want to with no chance of the plex server suddenly shutting down. I do not use Mint though I did in the past, before cinnamon, so I do not know if the Presentation Mode is an available option in Mint or cinnamon but it may be possible using another DE than Xfce so a search of panel applets is worth doing.

On my laptop, also with Xubuntu 18.04, the same option appears on a right click of the battery icon in the Notification Area applet so that seems the most likely place to start your search.
milon
Level 2
Level 2
Posts: 78
Joined: Thu Jan 10, 2019 3:20 pm

Re: Don't sleep while Plex is streaming?

Post by milon »

Yes, the server is running Linux Mint.

What you're both suggesting is ways to permanently disable Suspend. That's not what I'm trying to accomplish. I still want the system to Suspend - just not while Plex is streaming something.

How can I have Plex prevent Suspend while streaming?
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Don't sleep while Plex is streaming?

Post by smurphos »

milon wrote: Thu Mar 07, 2019 9:47 pm Yes, the server is running Linux Mint.

What you're both suggesting is ways to permanently disable Suspend. That's not what I'm trying to accomplish. I still want the system to Suspend - just not while Plex is streaming something.

How can I have Plex prevent Suspend while streaming?
You are asking for a slightly bizarre thing - servers by their nature are always on to serve so having one that suspends is a strange thing.

Having said that you are not the only person who wants this and some googling suggests some possible solutions. This one looks the simplest to implement.

https://www.collindelker.com/2016/10/16 ... take2.html
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Faust

Re: Don't sleep while Plex is streaming?

Post by Faust »

There are utilities called " Mouse Jigglers " which simulate constant tiny mouse moves to inhibit sleep / hibernate .

Most are for that "other " OS but this one claims to be cross-platform :-
https://sourceforge.net/projects/wigglemouse/

It is a clumsy workaround IMO , but it might do just what is needed in this case .
I haven't used it so can't make a recommendation ; I always used " Don't Sleep " on Windows systems , and Caffeine on Mint 17.3 .
User avatar
lsemmens
Level 11
Level 11
Posts: 3951
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: Don't sleep while Plex is streaming?

Post by lsemmens »

I am home again.

Under "System Settings" "Power Management" - I have set "turn off screen when inactive for 30 minutes" and "Suspend when inactive for Never"
Under "System Settings" "Screen Saver" "Settings"- "Delay before starting the screensaver Never" and "Lock the computer....." both off

There do not appear to be any settings within Plex so that should sort your issue. Works fine for me.
Fully mint Household
Out of my mind - please leave a message
milon
Level 2
Level 2
Posts: 78
Joined: Thu Jan 10, 2019 3:20 pm

Re: Don't sleep while Plex is streaming?

Post by milon »

Faust wrote: Fri Mar 08, 2019 3:01 am There are utilities called " Mouse Jigglers " which simulate constant tiny mouse moves to inhibit sleep / hibernate .

Most are for that "other " OS but this one claims to be cross-platform :-
https://sourceforge.net/projects/wigglemouse/

It is a clumsy workaround IMO , but it might do just what is needed in this case .
I haven't used it so can't make a recommendation ; I always used " Don't Sleep " on Windows systems , and Caffeine on Mint 17.3 .
Haha, I actually wrote my own mouse jiggler for that "other" OS, for other reasons. :D But for a mouse jiggler to be useful, I'd have to know the status of the Plex server - which I still can't get, as I mentioned above.
milon
Level 2
Level 2
Posts: 78
Joined: Thu Jan 10, 2019 3:20 pm

[SOLVED] Re: Don't sleep while Plex is streaming?

Post by milon »

Solved!

I finally figured it out. Here's how I did it, in case anyone else wants their main PC to not be on all the time. I needed a combination of Collin Delker's solution (the 2nd of those two links I posted earlier) along with my Plex token to get around the 401 Unauthorized error. I found the Plex token by following this guide:
https://forums.plex.tv/t/how-i-got-my-p ... lan/341703

I now have a systemctl service that gets triggered before Suspend, and it will abort the Suspend if Plex has 1 or more active streams.

Everyone else, thanks for your input!
Locked

Return to “Software & Applications”