|
SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Plugin / Utility request: shutdown SageTV and execute a batch file
Ok developers,
I'll be one of you guys' bestest friends ever if you would make a small plugin / addon / utility that will gracefully shutdown SageTV and then execute a DOS batch file or other executeable. 1) On a schedule, this doesn't need to be too advanced 2) Checks to make sure SageTV isn't recording before shutdown 3) Checks to see how much time before next scheduled recording, with a minimum threshold in minutes before shutdown 4) If failure to shutdown due to 2 or 3, then try again in x number of minutes with y number of retries 5) Writes datetime to a simple logfile with shutdown success, failure, retry, last retry
__________________
SageTV server & client: Win 10 Pro x64, Intel DH67CF, Core i5 2405s, 8 GB ram, Intel HD 3000, 40GB SSD system, 4TB storage, 2x HD PVR component + optical audio, USB-UIRT 2 zones + remote hack, Logitech Harmony One, HDMI output to Sony receiver with native Intel bitstreaming |
#2
|
||||
|
||||
Just out of curiosity (as it may help someone looking to do this for you anyways), but what functionality are you trying to get with this? It is possible it is something you could already do with existing tools. (Sage Job Queue comes to mind).
__________________
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 |
#3
|
|||
|
|||
Yup you can make this happen with SJQ.
Damn I need to reinstall it/upgrade. It's been too long. |
#4
|
||||
|
||||
I need to do some once-a-week or perhaps once-a-night things to my SageTV server, but I obviously don't want the server shutting down services, processing, and rebooting while SageTV is in the middle of recording.
My understanding of SJQ is that SageTV is still running though? I need SageTV completely shut down. And, I don't want to miss a recording if, for example, my nightly server job runs at 3:30am and unbeknownce to me SageTV had something scheduled for 3:35am. So it checks if SageTV is recording, or soon will be, and if not safely exits SageTV and runs the batch file / exe.
__________________
SageTV server & client: Win 10 Pro x64, Intel DH67CF, Core i5 2405s, 8 GB ram, Intel HD 3000, 40GB SSD system, 4TB storage, 2x HD PVR component + optical audio, USB-UIRT 2 zones + remote hack, Logitech Harmony One, HDMI output to Sony receiver with native Intel bitstreaming |
#5
|
||||
|
||||
Quote:
Gerry
__________________
Big Gerr _______ Server - WHS 2011: Sage 7.1.9 - 1 x HD Prime and 2 x HDHomeRun - Intel Atom D525 1.6 GHz, Acer Easystore, RAM 4 GB, 4 x 2TB hotswap drives, 1 x 2TB USB ext Clients: 2 x PC Clients, 1 x HD300, 2 x HD-200, 1 x HD-100 DEV Client: Win 7 Ultimate 64 bit - AMD 64 x2 6000+, Gigabyte GA-MA790GP-DS4H MB, RAM 4GB, HD OS:500GB, DATA:1 x 500GB, Pace RGN STB. |
#6
|
|||
|
|||
This is my ruleset and batch file.
I use windows scheduler to create a file c:\controls\oktoreboot.txt every sunday at 4:00 am. I have SJQ run this rule set anytime c:\controls\oktoreboot.txt exists. Code:
//Ok To Reboot if [FileExists == "c:\\controls\\oktoreboot.txt" && IsSomethingRecording == "false" && TranscodeQueueSize < "1" && TimeUntilNextRecording > "15M" && $.GetMediaTitle{} == "Not Recording" && TimeOfDay > "05:00" && TimeOfDay < "20:00"]{ :PRIORITY 110 OKTOREBOOT } This is my batch file it reboots the clients , Sage server and cleans up temp files. Code:
del c:\controls\oktoreboot.txt tskill wscript /a cd c:\SageBatch c: process -q SageTV.exe net stop SageTV del "C:\Documents and Settings\All Users\Application Data\TEMP" /q start shutdown -m \\sageclient -r -f -t 60 start shutdown -m \\nyplayer -r -f start shutdown -r -f -t 2 exit 1
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 12-27-2009 at 08:24 AM. |
#7
|
||||
|
||||
Is there a graceful way to exit SageTV programatically?
There's the exe message event {Power Off 44}, but as I recall that only minimizes SageTV to the taskbar? I know that externally I can kill the SageTV.exe process, but that's not really graceful.. might introduce some problems in the SageTV files.
__________________
SageTV server & client: Win 10 Pro x64, Intel DH67CF, Core i5 2405s, 8 GB ram, Intel HD 3000, 40GB SSD system, 4TB storage, 2x HD PVR component + optical audio, USB-UIRT 2 zones + remote hack, Logitech Harmony One, HDMI output to Sony receiver with native Intel bitstreaming |
#8
|
|||
|
|||
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. |
#9
|
||||
|
||||
Sage ships with a command-line utility called SendMessage.exe that can be used to send a WM_CLOSE or WM_QUIT message to the running UI.
For the service, use net stop as nyplayer indicates.
__________________
-- Greg |
#10
|
|||
|
|||
I am trying to get this shutdown script to work as well...totally new to SJQ...and am SOOO close. But I'm having a problem with the restart.
When the SJQ client batch file executes the restart, it does not complete. The restart begins, but then eventually I end up with a black screen and an arrow and the restart does not complete. I have to hit the power switch to reboot. When I manually run the batch file from the command prompt, it works great...and completes as normal. The only difference I an see is that when I run from the command prompt, the restart is initiated by Q6600\sage (my user name). When it is initiated from SJQ, the restart windows says the restart was initiated by NT AUTHORITY\SYSTEM. Could that be the problem? Any suggestions how I can fix it? |
#11
|
||||
|
||||
I'm trying to setup SJQ to restart sagetv during the night.
I use windows scheduler to create a file c:\controls\oktorestartsage.txt every night at 2:30 am. Code:
//Ok To Reboot if [FileExists == "c:\\controls\\oktoreboot.txt" && IsSomethingRecording == "false" && TranscodeQueueSize < "1" && TimeUntilNextRecording > "10M" && $.GetMediaTitle{} == "Not Recording" && TimeOfDay > "02:35" && TimeOfDay < "05:00"]{ :PRIORITY 110 OKTOREBOOT } Any idea's why it's not working?
__________________
ZZMystique My setup: Server: SageTV v7, Intel i5, 8GB, 180GB SSD, 4TB HDD, Win7HP & (DVB Viewer Pro with DVB Viewer for SageTV using 2xTBS6281 DVB-T2). |
#12
|
|||
|
|||
I used Videoredo to cut a recording(a few meg) and then I put it in the import folder then I used the webserver to name it Not Recording. You can use any title that you have just archive it and keep it around... I just got creative :-) for example && $.GetMediaTitle{} == "Double Jeopardy"
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 04-27-2010 at 07:03 AM. |
#13
|
||||
|
||||
Quote:
__________________
ZZMystique My setup: Server: SageTV v7, Intel i5, 8GB, 180GB SSD, 4TB HDD, Win7HP & (DVB Viewer Pro with DVB Viewer for SageTV using 2xTBS6281 DVB-T2). |
#14
|
||||
|
||||
Have the restart sage and reboot SJQ rules working now , it is working well.
Took me a little while to realise that the SJQ Task Client could not be stopped during the restart or reboot process otherwise the scripts would not complete. Cheers
__________________
ZZMystique My setup: Server: SageTV v7, Intel i5, 8GB, 180GB SSD, 4TB HDD, Win7HP & (DVB Viewer Pro with DVB Viewer for SageTV using 2xTBS6281 DVB-T2). |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Utility: Batch Metadata Importer 3.x | stuckless | Batch Metadata Tools | 2416 | 09-20-2011 08:03 PM |
Execute a batch file after an error? | eric3a | SageTV Customizations | 0 | 08-12-2009 09:37 PM |
Batch file to shutdown Sage (not sleep) | pknowles | SageTV Software | 1 | 11-16-2007 03:37 PM |
Feature Request: "Copy file" for Sage Conversion utility | pawn | SageTV Software | 5 | 07-10-2007 05:36 PM |
hs_err_pid log file from an exepected SageTV 1.4 shutdown | carlgar | SageTV Software | 0 | 05-22-2004 11:02 PM |