NextPVR Forums

Full Version: UpdateEPG.bat not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Is there a good way to debug this? Windows 8.1. I can run this bat file from the command line, runs fine. I can run it from the update EPG link in the nextpvr app under channels, runs. However, the daily run at time comes, and, passes with no update. So, I look in the nrecord.log file and see:

2014-12-17 08:08:24.769 [DEBUG][10] Pre EPG Update
2014-12-17 08:09:54.770 [DEBUG][10] About to update EPG
2014-12-17 08:09:54.793 [DEBUG][10] Updating EPG...
2014-12-17 08:09:54.794 [DEBUG][10] Running UpdateEPG.bat
2014-12-17 08:09:54.794 [DEBUG][10] About to run C:\Users\Public\NPVR\Scripts\UpdateEPG.bat
2014-12-17 08:10:04.800 [DEBUG][10] C:\Users\Public\NPVR\Scripts\UpdateEPG.bat has completed
2014-12-17 08:10:04.800 [DEBUG][10] Checking for any XMLTV listings
2014-12-17 08:10:04.837 [DEBUG][10] Will process xmltv file: C:\ProgramData\ServerCare\WebGrab\mdb\guide.xml
2014-12-17 08:10:04.838 [DEBUG][10] Skipping non-existant xmltv file: C:\ProgramData\ServerCare\WebGrab\mdb\guide.xml

Please note the non existant file does in fact exist, and, that the update epg script runs for an hour. I am not going to be using WebGrabber for when I go live with this, (will be using schedules direct but not going to purchase it until whole system is set up and all functioning as I want it) but, it's convenient for testing purposes. When the log file shows it running in 10 seconds, it's not running. But the clues are I suppose 10 seconds, and, the non existant file, and, that it works from Update EPG and command line. Sounds like security. However, I don't know what user the service runs under, and, I thought that the service as set up by the installer which runs as local system user should be fine with all default directories created by the installer, I cant seem to find anything wrong. But obviously there is. I don't really use Windows very much, so, not sure of the ins and outs or what to check.

The bat file contains:

@ECHO off
:CheckOS
IF EXIST "%PROGRAMFILES(X86)%" (GOTO BIT64) ELSE (GOTO BIT32)

:BIT64
SET ProgramPath=%PROGRAMFILES(X86)%
GOTO END

:BIT32
SET ProgramPath=%PROGRAMFILES%
GOTO END

:END
"%ProgramPath%\ServerCare\WebGrab+PlusV1.1.1\WebGrab+Plus.exe" "C:\ProgramData\ServerCare\WebGrab"

@REM comment out next line, to stop the command window from automaticly closing
@REM PAUSE

EXIT
I'm guessing it is permissions. I'm guessing either WebGrab+Plus.exe has some configuration files which are not accessible to the program when the recording service runs it under the localsystem account, or it doesn't have access to this output directory (so can't overwrite the file there from your previous manual run, and the application can't see/read the xmltv file from that location.

You'll always get approximately a 10 second delay around the "About to run C:\Users\Public\NPVR\Scripts\UpdateEPG.bat" message, due to a sleep in there.
sub Wrote:I'm guessing it is permissions. I'm guessing either WebGrab+Plus.exe has some configuration files which are not accessible to the program when the recording service runs it under the localsystem account, or it doesn't have access to this output directory (so can't overwrite the file there from your previous manual run, and the application can't see/read the xmltv file from that location.

Say it is permissions. Using windows file manager, what user would I look under to check effective permissions? What does "local system user" mean? is that the user I am logged in as? Must not be since it runs from command line as me. I don't know what user to check. User name that is. And permissions screens ask for an object, and, I don't know what object or user to use.

I checked for an object or user named localsystem, there is none. There is a "local account" and a "local service". And also a "local account and member of administrations group". Just not familiar with security in Windows 8.1. Everything else seems to work. I can adjust any security, but, not sure what effective user to check.
sfatula Wrote:Say it is permissions. Using windows file manager, what user would I look under to check effective permissions?
I don't know - not my area of expertise.

Quote:What does "local system user" mean? is that the user I am logged in as?
In process explorer, the username of NRecord.exe (and most other services) is shown as "NT AUTHORITY\SYSTEM".
Maybe try hard-coding the directory paths in the double-quotes instead of using system variables? Just a thought.
P.S. Another thought, although I have the UpdateEPG.Bat file in the NPVR directory, it calls up another Bat file which is located in the same directory as the program it is running. So I don't actually use any file paths in that Bat file. Just in the UpdateEPG.Bat file, to call up the secondary Bat file. I did this just to simplify the filenames by getting rid of the pathnames, no other good reason... Smile
christheman Wrote:So I don't actually use any file paths in that Bat file.

This is another problem when running as local system rather than a logged on user. The Windows environment with things like paths is vastly different to a logged in environment. The batch file will be running in a different place to what you think - safest is to CD to whererever you want it to run from and include paths to anything that is not there.
martint123 Wrote:This is another problem when running as local system rather than a logged on user. The Windows environment with things like paths is vastly different to a logged in environment. The batch file will be running in a different place to what you think - safest is to CD to whererever you want it to run from and include paths to anything that is not there.

Yeah, that is another way around it. To change directory immediately before your operations in the Bat file.

My suggestions were mainly for the sake of troubleshooting. It looks to me as if the OP might have been using a stock Bat script that somebody else wrote.

Also, to the OP, I see this line in your Bat file:
Code:
"%ProgramPath%\ServerCare\WebGrab[color=#FF0000]+[/color]PlusV1.1.1\WebGr[color=#FF0000][space][/color]ab[color=#FF0000]+[/color]Plus.exe" "C:\ProgramData\ServerCare\WebGrab"

Within that line I see a couple "plus" operators and also a questionable space character, which I have made highlighted in red. Also the periods in the name "PlusV1.1.1" may be confusing in the DOS environment. I would chop those out too. Try making the file path as simple as possible.
Another P.S.

I forgot to say that if the OP thinks it might be related to the machine running it as "local machine", then there is the "runas" command where the user name could be substituted.

runas [{/profile|/noprofile}] [/env] [/netonly] [/smartcard] [/showtrustlevels] [/trustlevel] /user:UserAccountName program

https://www.microsoft.com/resources/docu...x?mfr=true

So a test line might look something like this:
Code:
runas /user:sfatula "%ProgramPath%\ServerCare\WebGrab+PlusV1.1.1\WebGr ab+Plus.exe" "C:\ProgramData\ServerCare\WebGrab"
(anomalies as noted above left intact)
sub Wrote:In process explorer, the username of NRecord.exe (and most other services) is shown as "NT AUTHORITY\SYSTEM".

That's the only clue I needed, it works now, thanks! So, for anyone else who might use WebGrabberPlus, and NextPVR, on Windows 8.1 and possibly other versions (not a Windows guy), the directory C:\ProgramData\ServerCare needs to have its permissions adjusted. Add user SYSTEM with permission for full control and you will be fine.
Pages: 1 2