2014-03-05, 12:46 PM
My days of programming batch files are a bit rusty so I think Iâm missing something very basic here.
Having just built a new NPVR system with a quad tuner where I could be recording multiple HD programmes concurrently whilst playing back previously recorded HD content, I was concerned about the potential throughput bottleneck and wear & tear on my new 3Tb hard disks.
I decided that a better approach may be to use an SSD as a âhigh speedâ recoding cache and then move the recordings to the hard disk as they complete using the PostProcessing.bat file.
I set the PostProcessing.bat file to call a file Move.bat logging to a log file in the Logs directory. The Move.bat file checks the recording exists in the relevant directory on the SSD, copies it to the new location, checks the new file/directory exists, updates the database then deletes the old recording file.
Iâve proven this works reliably (even handling when the file name contains an â&â which proved tricky in variables in a batch file ).
The other night I noticed that some recordings hadnât been moved from the SSD cache. I checked my log file and couldnât find any trace of a request to move these files or any error. When I checked the NPVR logs I find that the problem occurs when multiple recordings finish at exactly the same time. The first recording details are submitted to the PostProcessing.bat and it triggers the move process which completes successfully and logs the results in my log file.
The 2nd (and any other recordings which complete at the same instant) are logged in the NPVR log as calling PostProcessing.bat and passing the correct parameters however there is no record of these 2nd or subsequent calls to Postprocessing.bat actually resulting in the batch file running.
The 1st call to the PostProcessing.bat file would have still been running when the 2nd, 3rd call etc. would have been made. My log file records the 1st running of the PostProcessing.bat file but shows no evidence of the additional calls nor are there any errors in the Windows or NPVR logs.
Iâm assuming here that the problem may be that running concurrent instances of PostProcessing.bat isnât being allowed and the 2nd and subsequent calls are being ignored because itâs already running. If thatâs the case how can I fix this?
Any ideas anyone?
Having just built a new NPVR system with a quad tuner where I could be recording multiple HD programmes concurrently whilst playing back previously recorded HD content, I was concerned about the potential throughput bottleneck and wear & tear on my new 3Tb hard disks.
I decided that a better approach may be to use an SSD as a âhigh speedâ recoding cache and then move the recordings to the hard disk as they complete using the PostProcessing.bat file.
I set the PostProcessing.bat file to call a file Move.bat logging to a log file in the Logs directory. The Move.bat file checks the recording exists in the relevant directory on the SSD, copies it to the new location, checks the new file/directory exists, updates the database then deletes the old recording file.
Iâve proven this works reliably (even handling when the file name contains an â&â which proved tricky in variables in a batch file ).
The other night I noticed that some recordings hadnât been moved from the SSD cache. I checked my log file and couldnât find any trace of a request to move these files or any error. When I checked the NPVR logs I find that the problem occurs when multiple recordings finish at exactly the same time. The first recording details are submitted to the PostProcessing.bat and it triggers the move process which completes successfully and logs the results in my log file.
The 2nd (and any other recordings which complete at the same instant) are logged in the NPVR log as calling PostProcessing.bat and passing the correct parameters however there is no record of these 2nd or subsequent calls to Postprocessing.bat actually resulting in the batch file running.
The 1st call to the PostProcessing.bat file would have still been running when the 2nd, 3rd call etc. would have been made. My log file records the 1st running of the PostProcessing.bat file but shows no evidence of the additional calls nor are there any errors in the Windows or NPVR logs.
Iâm assuming here that the problem may be that running concurrent instances of PostProcessing.bat isnât being allowed and the 2nd and subsequent calls are being ignored because itâs already running. If thatâs the case how can I fix this?
Any ideas anyone?
NPVR Version= 6.1.5.231022
Intel i7 Quad Core 3200 + 16GB DDR3 Gigabyte Motherboard
Windows 11 Pro 64bit
TBS-6902 dual DVB-S tuner
TBS-6205 quad DVB-T tuner
500Gb System Disk (M2 Nvme SSD)
4Tb Media Store (2 x 2Tb M2 Nvme SSD Raid 0)
Raspberry Pi3 B+ , Pi4B (OSMC) and Pi5 (XBian) all running Kodi v21.1
Intel i7 Quad Core 3200 + 16GB DDR3 Gigabyte Motherboard
Windows 11 Pro 64bit
TBS-6902 dual DVB-S tuner
TBS-6205 quad DVB-T tuner
500Gb System Disk (M2 Nvme SSD)
4Tb Media Store (2 x 2Tb M2 Nvme SSD Raid 0)
Raspberry Pi3 B+ , Pi4B (OSMC) and Pi5 (XBian) all running Kodi v21.1