SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-18-2013, 11:02 AM
bialio's Avatar
bialio bialio is offline
SageTVaholic
 
Join Date: May 2007
Location: Frisco, TX
Posts: 3,445
Monitor if the sage service is still running remotely

I've been looking for a way to keep tabs on the SageService when I'm away from home.

SageAlert does a great job of informing me while I'm out about if something bad happens but the SageService is still running - tuner failure, etc.

But there's a bug I run into occasionally where the Sage Service flat out dies - it's processing an image from the photo library when it does it (screensaver) - and once that happens I have to log in and restart the service.

I found a sight : www.pingdom.com - it basically will monitor a single website for you and email / tweet / SMS you if it goes down. 1 for free at least, you can pay to monitor multiple websites if you feel so inclined.

So I have it looking at the TCP connection to my Sage Web Server - if it can't connect to port 8080 that's a pretty good indication that the SageService has crapped out. And I get notified within 5 minutes!

Anyway, this is a good solution for me - I'm sure there are others out there that manage this issue in similar manner....
__________________
PHOENIX 3 is here!
Server : Linux V9, Clients : Win10 and Nvidia Shield Android Miniclient
Reply With Quote
  #2  
Old 03-18-2013, 12:05 PM
will will is offline
Sage Fanatic
 
Join Date: Jul 2009
Location: New York
Posts: 797
Quote:
Originally Posted by bialio View Post
I've been looking for a way to keep tabs on the SageService when I'm away from home.
I wrote a really simple batch script that I schedule to run every 15 minutes. It checks if the service is running, if not, it starts it and sends me an email.

Glad to share it if you think it would fit your needs.
__________________
Will

OS: Windows 7
Hardware: Intel Core i7-920 with 12GB RAM & an Adaptec 5805 with a Chenbro 36-port SAS Expander
Case: Antec 1200 with 4 iStarUSA trayless hot-swap cages (20 drives max)
Drives: 8 Toshiba/Hitachi 2TB drives in a RAID 6 & 7 Toshiba 3TB drives in a RAID 6
Capture Cards: HDHomeRun Connect Quatro 4, Hauppauge 60 HD-PVR
Players: 5 HD300s, 2 HD200s, 1 Client, 1 MiniClient
Reply With Quote
  #3  
Old 03-18-2013, 12:22 PM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,098
Quote:
Originally Posted by will View Post
I wrote a really simple batch script that I schedule to run every 15 minutes. It checks if the service is running, if not, it starts it and sends me an email.

Glad to share it if you think it would fit your needs.
I have a similar script that runs at startup and will check for any service that is set to Automatic and if it stops for any reason it will restart them .. it keeps monitoring indefinitely. I use it on my server.
__________________
Windows 10 I3 Dual Core 3.0 Server, SageTV9... OpenDCT with 2 HDHRPrimes and 4 HDHRconnects for a total of 14 Tuners.

Last edited by nyplayer; 03-18-2013 at 12:27 PM.
Reply With Quote
  #4  
Old 03-18-2013, 07:48 PM
bialio's Avatar
bialio bialio is offline
SageTVaholic
 
Join Date: May 2007
Location: Frisco, TX
Posts: 3,445
When you say you have a 'script' - what does that mean exactly? Is it a batch file? Some other language? I am familiar with *nix OS scripts of various sorts, but I've not had any exposure to Windows scripting...
__________________
PHOENIX 3 is here!
Server : Linux V9, Clients : Win10 and Nvidia Shield Android Miniclient
Reply With Quote
  #5  
Old 03-18-2013, 08:00 PM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,098
I have a vbs Script.

Code:
do
WScript.sleep 5000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
 ("Select * from Win32_Service Where State = 'Stopped' and StartMode = " _
     & "'Auto'")
For Each objService in colListOfServices
    objService.StartService()
Next
loop
__________________
Windows 10 I3 Dual Core 3.0 Server, SageTV9... OpenDCT with 2 HDHRPrimes and 4 HDHRconnects for a total of 14 Tuners.
Reply With Quote
  #6  
Old 03-19-2013, 03:05 AM
will will is offline
Sage Fanatic
 
Join Date: Jul 2009
Location: New York
Posts: 797
Here is my batch script. For the mail command, I am using a simple Windows command line program I found online (because you can't send email natively from Windows).

Code:
@echo off
sc query "SageTV" | find "RUNNING"
if %ERRORLEVEL% == 2 goto trouble
if %ERRORLEVEL% == 1 goto stopped
if %ERRORLEVEL% == 0 goto started
echo unknown status
goto end

:trouble
echo trouble
echo The SageTV Service reported error level 2. Attempting to stop and start the service. > C:\outputSage.txt
echo. >> C:\outputSage.txt
NET STOP "SageTV" >> C:\outputSage.txt
NET START "SageTV" >> C:\outputSage.txt
mail -s MAILSERVER -t me@emailaddress.com -f from@emailaddress.com -h -a "SageTV Service Error" -m C:\outputSage.txt
del C:\outputSage.txt
goto end

:started
echo started
goto end

:stopped
echo stopped
echo The SageTV Service was reported as stopped. Attempting to start the service. > C:\outputSage.txt
echo. >> C:\outputSage.txt
NET START "SageTV" >> C:\outputSage.txt
mail -s MAILSERVER -t me@emailaddress.com -f from@emailaddress.com -h -a "SageTV Service Error" -m C:\outputSage.txt
del C:\outputSage.txt
goto end

:end
__________________
Will

OS: Windows 7
Hardware: Intel Core i7-920 with 12GB RAM & an Adaptec 5805 with a Chenbro 36-port SAS Expander
Case: Antec 1200 with 4 iStarUSA trayless hot-swap cages (20 drives max)
Drives: 8 Toshiba/Hitachi 2TB drives in a RAID 6 & 7 Toshiba 3TB drives in a RAID 6
Capture Cards: HDHomeRun Connect Quatro 4, Hauppauge 60 HD-PVR
Players: 5 HD300s, 2 HD200s, 1 Client, 1 MiniClient
Reply With Quote
  #7  
Old 03-19-2013, 03:08 AM
will will is offline
Sage Fanatic
 
Join Date: Jul 2009
Location: New York
Posts: 797
Quote:
Originally Posted by bialio View Post
When you say you have a 'script' - what does that mean exactly? Is it a batch file?
It is just a text file that ends in .bat instead of .txt. I'm using the built-in task scheduler on Windows to run the script every 30 minutes.

If you are running Sage on Linux (I've never have) you could probably write a simple BASH script that will check if the SageTV daemon is running.
__________________
Will

OS: Windows 7
Hardware: Intel Core i7-920 with 12GB RAM & an Adaptec 5805 with a Chenbro 36-port SAS Expander
Case: Antec 1200 with 4 iStarUSA trayless hot-swap cages (20 drives max)
Drives: 8 Toshiba/Hitachi 2TB drives in a RAID 6 & 7 Toshiba 3TB drives in a RAID 6
Capture Cards: HDHomeRun Connect Quatro 4, Hauppauge 60 HD-PVR
Players: 5 HD300s, 2 HD200s, 1 Client, 1 MiniClient
Reply With Quote
  #8  
Old 03-20-2013, 06:23 PM
WellThen's Avatar
WellThen WellThen is offline
Sage Advanced User
 
Join Date: Dec 2005
Location: The Great Pagoda of Funn
Posts: 193
Quote:
Originally Posted by will View Post
Here is my batch script. For the mail command, I am using a simple Windows command line program I found online (because you can't send email natively from Windows).
Hi Will,

Thanks, I'm going to use your script. Can you tell us the name of the mail command line program you use?
Reply With Quote
  #9  
Old 03-21-2013, 11:08 AM
will will is offline
Sage Fanatic
 
Join Date: Jul 2009
Location: New York
Posts: 797
Quote:
Originally Posted by WellThen View Post
Hi Will,

Thanks, I'm going to use your script. Can you tell us the name of the mail command line program you use?

The program is called Command Line SMTP Mailer for Batch Jobs.

Here is a direct download link.
__________________
Will

OS: Windows 7
Hardware: Intel Core i7-920 with 12GB RAM & an Adaptec 5805 with a Chenbro 36-port SAS Expander
Case: Antec 1200 with 4 iStarUSA trayless hot-swap cages (20 drives max)
Drives: 8 Toshiba/Hitachi 2TB drives in a RAID 6 & 7 Toshiba 3TB drives in a RAID 6
Capture Cards: HDHomeRun Connect Quatro 4, Hauppauge 60 HD-PVR
Players: 5 HD300s, 2 HD200s, 1 Client, 1 MiniClient
Reply With Quote
  #10  
Old 03-21-2013, 02:08 PM
doc doc is offline
Sage Fanatic
 
Join Date: Jun 2006
Location: Leicester, England
Posts: 915
I used to use bmail.exe but now use sendemail.exe from

http://caspian.dotconf.net/menu/Software/SendEmail/

I couldn't get bmail to work with a yahoo account. It might have been finger trouble but sendemail worked fine.
Reply With Quote
  #11  
Old 03-21-2013, 03:17 PM
will will is offline
Sage Fanatic
 
Join Date: Jul 2009
Location: New York
Posts: 797
Quote:
Originally Posted by doc View Post
I couldn't get bmail to work with a yahoo account. It might have been finger trouble but sendemail worked fine.
I bet Yahoo requires authentication to use it's SMTP server, not sure if bmail supports it or not. If you are sending the message to a Yahoo address, try using the server mta5.am0.yahoodns.net. It shouldn't require authentication because you are just connecting to the server to send a message to a Yahoo email address.

I bet sendmail is coded so it looks up the MX record of the email server and connects directly to that (it probably doesn't require you to set the SMTP server).
__________________
Will

OS: Windows 7
Hardware: Intel Core i7-920 with 12GB RAM & an Adaptec 5805 with a Chenbro 36-port SAS Expander
Case: Antec 1200 with 4 iStarUSA trayless hot-swap cages (20 drives max)
Drives: 8 Toshiba/Hitachi 2TB drives in a RAID 6 & 7 Toshiba 3TB drives in a RAID 6
Capture Cards: HDHomeRun Connect Quatro 4, Hauppauge 60 HD-PVR
Players: 5 HD300s, 2 HD200s, 1 Client, 1 MiniClient
Reply With Quote
  #12  
Old 03-22-2013, 09:36 PM
WellThen's Avatar
WellThen WellThen is offline
Sage Advanced User
 
Join Date: Dec 2005
Location: The Great Pagoda of Funn
Posts: 193
Thanks to both Will and Doc. I ended up grabbing sendemail, and setup was easy as pie!
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
When running as service why does starting Sage UI say SageTV Service is initializing? GollyJer SageTV Software 2 12-27-2006 09:59 AM
Running Sage as a Service Cugrz SageTV Software 6 02-15-2005 02:52 PM
can you use the latest sage without running as a service? jimbobuk SageTV Software 3 01-19-2005 02:30 PM
Running Sage Fullscreen on a secondary monitor Motab SageTV Software 3 01-02-2005 10:29 PM


All times are GMT -6. The time now is 05:45 PM.


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