SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Linux > SageTV for unRAID/Docker

Notices

SageTV for unRAID/Docker Discussion related to SageTV for unRAID/Docker. Questions, issues, problems, suggestions, etc. relating to SageTV for unRAID/Docker should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-25-2017, 09:08 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
How would you run a script when the Docker starts?

I wouldn't mind rebooting my extenders when my Docker restarts. How do I initiate a script when the Docker starts. I think in linux this is done in something like an rc.d file - is there something similar when a docker starts?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #2  
Old 01-26-2017, 05:52 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,682
if /opt/sagetv/server/sagetv-user-script.sh exists it will be run immediately before the SageTV starts.
Reply With Quote
  #3  
Old 01-26-2017, 09:01 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
Great, thanks. Does this script have to terminate before Sage starts or is the Sage start done in parallel? What I am looking at doing is running a script that restarts my extenders and have them autoconnect to Sage. But Sage will have to be up and running in order for that to happen.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #4  
Old 01-26-2017, 10:59 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
sage's startup will not continue until the script is done.

That said, if you start up the extender while the server is unavailable, it send a wake-up packet and wait for the server to become available, and once it is, it will connected to it, so you should be able to reboot your extender in the startup script, and once sage is up, the extender will connect.
Attached Images
File Type: jpg 0126170900.jpg (44.9 KB, 195 views)
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room

Last edited by Fuzzy; 01-26-2017 at 11:04 AM.
Reply With Quote
  #5  
Old 01-26-2017, 11:18 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,682
Quote:
Originally Posted by wayner View Post
Great, thanks. Does this script have to terminate before Sage starts or is the Sage start done in parallel? What I am looking at doing is running a script that restarts my extenders and have them autoconnect to Sage. But Sage will have to be up and running in order for that to happen.
It's a script, so "as is" it will block, but in linux, your script can simply start a background process if you call another command/script and end it will &

so if this script called...
Code:
do-my-long.task.sh
then it would block.. but if it called
Code:
do-my-long-task.sh &
Then it would return immediately and "do-my-long-task.sh" would continuing running.
Reply With Quote
  #6  
Old 01-26-2017, 12:18 PM
SomeWhatLost's Avatar
SomeWhatLost SomeWhatLost is offline
Sage Expert
 
Join Date: Jan 2009
Location: earth
Posts: 528
just curious, my extenders seem to reboot automatically when the docker is restarted... even the ones that were not on or in use at the time I need to wander by and turn them off afterwards...
I thought that was their normal behavior?
__________________
NOTE: As one wise professional something once stated, I am ignorant & childish, with a mindset comparable to 9/11 troofers and wackjob conspiracy theorists. so don't take anything I say as advice...
Reply With Quote
  #7  
Old 01-26-2017, 12:51 PM
EnterNoEscape's Avatar
EnterNoEscape EnterNoEscape is offline
SageTVaholic
 
Join Date: Jun 2010
Location: Harrisburg, PA
Posts: 2,654
Quote:
Originally Posted by SomeWhatLost View Post
just curious, my extenders seem to reboot automatically when the docker is restarted... even the ones that were not on or in use at the time I need to wander by and turn them off afterwards...
I thought that was their normal behavior?
I believe the SageTCPServer plugin would do this.
__________________
SageTV v9 Server: ASRock Z97 Extreme4, Intel i7-4790K @ 4.4Ghz, 32GB RAM, 6x 3TB 7200rpm HD, 2x 5TB 7200rpm HD, 2x 6TB 7200rpm HD, 4x 256GB SSD, 4x 500GB SSD, unRAID Pro 6.7.2 (Dual Parity + SSD Cache).
Capture: 1x Ceton InfiniTV 4 (ClearQAM), 2x Ceton InfiniTV 6, 1x BM1000-HDMI, 1x BM3500-HDMI.

Clients: 1x HD300 (Living Room), 1x HD200 (Master Bedroom).
Software: OpenDCT :: WMC Live TV Tuner :: Schedules Direct EPG
Reply With Quote
  #8  
Old 01-26-2017, 02:07 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
Quote:
Originally Posted by EnterNoEscape View Post
I believe the SageTCPServer plugin would do this.
I think you are right. I used to use that but it had a bug where it would only store the IP or MAC addresses of 10 miniclients. Any more and it would cause issues. So if you happened to use Placeshifter on a PC once then it would take up a slot, unless you went and cleaned out the list in the sage.properties file.

I think the other option for me may be SJQ as I think you can kick off jobs for when Sage starts up, in addition to Recording Started, Recording Stopped, Cron jobs, etc.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #9  
Old 01-27-2017, 12:41 PM
SomeWhatLost's Avatar
SomeWhatLost SomeWhatLost is offline
Sage Expert
 
Join Date: Jan 2009
Location: earth
Posts: 528
Quote:
Originally Posted by EnterNoEscape View Post
I believe the SageTCPServer plugin would do this.
you are probably correct I do use the SageTCPServer plugin to talk to my CQC HA server...
so it is not just a default sage thing after all?

I did not know about the 10 client limit though... that may be problematic at some point in the future...
in my case that would mostly be because of Stuckless and his incredibly cool mini client... I just cant help but load it up on every android device I come across...
someone leaves their phone unlocked, they get a mini client installed...
that is just the way it is...
can't be helped...
I blame stuckless..
__________________
NOTE: As one wise professional something once stated, I am ignorant & childish, with a mindset comparable to 9/11 troofers and wackjob conspiracy theorists. so don't take anything I say as advice...

Last edited by SomeWhatLost; 01-27-2017 at 12:47 PM.
Reply With Quote
  #10  
Old 01-27-2017, 01:06 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
I can't find specific mention of the ten device limit in the thread but I remember hearing it from Fonceur - it might have been in a PM. I believe the limit was because it reserved a port for each miniclient and they didn't consider that some of the miniclients may be transient - in the past I would often use Placeshifter to connect to a server to try something out but never use Placeshifter on that computer again. There is less reason not to do this today as, as was mentioned, there are clients for mobile devices, and there is no licensing requirement for Placeshifter.

It would be nice if this limit could be eliminated but I don't think anyone if maintaining SageTCPServer anymore.

edit - And no, it is definitely not part of the core of SageTV, but maybe it should be?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server

Last edited by wayner; 01-27-2017 at 01:22 PM.
Reply With Quote
  #11  
Old 01-27-2017, 02:48 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,682
Quote:
Originally Posted by SomeWhatLost View Post
you are probably correct I do use the SageTCPServer plugin to talk to my CQC HA server...
so it is not just a default sage thing after all?

I did not know about the 10 client limit though... that may be problematic at some point in the future...
in my case that would mostly be because of Stuckless and his incredibly cool mini client... I just cant help but load it up on every android device I come across...
someone leaves their phone unlocked, they get a mini client installed...
that is just the way it is...
can't be helped...
I blame stuckless..
That's aweseome
Reply With Quote
  #12  
Old 01-27-2017, 03:07 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
And I hope you have a large JVM heap size and lots of upload bandwidth to deal with all of those miniclients.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #13  
Old 01-27-2017, 04:07 PM
SomeWhatLost's Avatar
SomeWhatLost SomeWhatLost is offline
Sage Expert
 
Join Date: Jan 2009
Location: earth
Posts: 528
Quote:
Originally Posted by wayner View Post
And I hope you have a large JVM heap size and lots of upload bandwidth to deal with all of those miniclients.
local network only...

and yes, I set JVM heap to like 4 gig or something... and for some reason (could be my imagination?) Docker Sage does not seem to use it up as quickly as windows did...
__________________
NOTE: As one wise professional something once stated, I am ignorant & childish, with a mindset comparable to 9/11 troofers and wackjob conspiracy theorists. so don't take anything I say as advice...
Reply With Quote
  #14  
Old 01-27-2017, 04:41 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
Quote:
Originally Posted by SomeWhatLost View Post
local network only...

and yes, I set JVM heap to like 4 gig or something... and for some reason (could be my imagination?) Docker Sage does not seem to use it up as quickly as windows did...
It wouldn't surprise me if there is a memory leak in Windows as occasionally I will get JVM heap issues with only a couple of extenders attached, especially if there have been many other extenders attached, and then detached, since the last reboot. Maybe those memory leaks don't occur in Linux.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #15  
Old 01-27-2017, 09:31 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by wayner View Post
It wouldn't surprise me if there is a memory leak in Windows as occasionally I will get JVM heap issues with only a couple of extenders attached, especially if there have been many other extenders attached, and then detached, since the last reboot. Maybe those memory leaks don't occur in Linux.
When I started messing with SageTV on Linux I immediately noticed that it seemed to use significantly less memory than in Windows. Not sure why that would be?
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #16  
Old 01-27-2017, 11:03 PM
EnterNoEscape's Avatar
EnterNoEscape EnterNoEscape is offline
SageTVaholic
 
Join Date: Jun 2010
Location: Harrisburg, PA
Posts: 2,654
Quote:
Originally Posted by Taddeusz View Post
When I started messing with SageTV on Linux I immediately noticed that it seemed to use significantly less memory than in Windows. Not sure why that would be?
My best guess would be that V4L is a much lighter protocol to work with over BDA. There's also some differences in how some of the native code is compiled for Linux vs Windows that would contribute to the overall memory footprint.
__________________
SageTV v9 Server: ASRock Z97 Extreme4, Intel i7-4790K @ 4.4Ghz, 32GB RAM, 6x 3TB 7200rpm HD, 2x 5TB 7200rpm HD, 2x 6TB 7200rpm HD, 4x 256GB SSD, 4x 500GB SSD, unRAID Pro 6.7.2 (Dual Parity + SSD Cache).
Capture: 1x Ceton InfiniTV 4 (ClearQAM), 2x Ceton InfiniTV 6, 1x BM1000-HDMI, 1x BM3500-HDMI.

Clients: 1x HD300 (Living Room), 1x HD200 (Master Bedroom).
Software: OpenDCT :: WMC Live TV Tuner :: Schedules Direct EPG
Reply With Quote
  #17  
Old 01-31-2017, 08:47 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
Quote:
Originally Posted by stuckless View Post
if /opt/sagetv/server/sagetv-user-script.sh exists it will be run immediately before the SageTV starts.
One further question on this - will this script also be run whenever the SageTV service (if that is still the right term in unRAID) restarts, such as when a Plugin forces a restart?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #18  
Old 01-31-2017, 08:48 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
No, this is run only when the startup is done when the container loads.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #19  
Old 01-31-2017, 08:55 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,196
So any suggestions on how to do this - I want to ensure that some of my extenders are connected and if you do a restart of the Sage service then the extender will lose the connection.

I thought that it was possible to use SJQ to start a task when SageTV starts but it turns out that isn't the case, as you can only attach tasks to: RecordingStarted, RecordingStopped, SystemMessagePosted, or MediaFileImported. Would it be possibel to have a SystemMessage generated whenever SageTV starts?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #20  
Old 01-31-2017, 09:18 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by wayner View Post
So any suggestions on how to do this - I want to ensure that some of my extenders are connected and if you do a restart of the Sage service then the extender will lose the connection.

I thought that it was possible to use SJQ to start a task when SageTV starts but it turns out that isn't the case, as you can only attach tasks to: RecordingStarted, RecordingStopped, SystemMessagePosted, or MediaFileImported. Would it be possibel to have a SystemMessage generated whenever SageTV starts?
This would best be done by a separate plugin. Sure a system message COULD be generated on a restart, but if the only purpose of that message is to be able to force SJQ into doing a task on startup, then it'd be better to just make a simpler plugin that will just do what you are looking for. Plugins have an init function that is run on startup, and this capability could be built in there.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to stop docker? matt91 SageTV for unRAID/Docker 2 01-16-2017 04:37 PM
Is unRAID/Docker the right OS for me? wayner SageTV for unRAID/Docker 32 01-12-2017 03:08 PM
Docker container coppit SageTV Github Development 20 09-06-2015 06:26 PM
NASs? Docker? ThePaladinTech SageTV Github Development 10 08-16-2015 02:34 PM
Unfortunate behavior when fav #5 starts at 11:05pm but fav #15 starts at 11:00pm rmellor SageTV Software 16 03-23-2005 03:05 AM


All times are GMT -6. The time now is 02:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.