Media Center Master community forums
http://forums.MediaCenterMaster.com/

Check NAS before processing
http://forums.MediaCenterMaster.com/viewtopic.php?f=5&t=12322
Page 1 of 1

Author:  Thunderbolt [ June 4th, 2018, 5:39 am ]
Post subject:  Check NAS before processing

Hi there,

Would it be possible to add an option to check NAS I.P address is responding to ping before running any further automation processes?

Author:  SirKron [ May 8th, 2019, 1:58 pm ]
Post subject:  Re: Check NAS before processing

+1

I have come home from travel a few times to find my MCM box (laptop w/battery) has redownloaded many seasons of files because my NAS shut down during a power outage and did not come back up.

Author:  scripted [ July 30th, 2019, 12:24 pm ]
Post subject:  Re: Check NAS before processing

How about as a workaround for now setting your download folder path as on your nas box? that way if its offline it wont be able to download anything.

Author:  Pete [ July 30th, 2019, 12:37 pm ]
Post subject:  Re: Check NAS before processing

It'd be fairly trivial to just shut down Media Center Master when the NAS isn't running and restart MCM when it is.

You can do this by comparing the PING output in a batch file, bash script, PowerShell script, etc. and calling MediaCenterMaster.exe with /close to gracefully close all MCM processes. When the server is responding again, you can call MediaCenterMaster with /single to force MCM to only run a single instance.

Author:  scripted [ August 16th, 2019, 3:11 pm ]
Post subject:  Re: Check NAS before processing

I tried doing this Pete to compare ping output in a script to try and help and my laptop ended up in a tree.
There was nothing graceful about it.
:lol:
Hopefully the OP had better luck.

Author:  Pete [ August 16th, 2019, 5:47 pm ]
Post subject:  Re: Check NAS before processing

Just change 'hosttocheck' to whatever your NAS IP is.

Save it as 'waitfornetwork.bat' and CALL it from another batch file, etc. as needed.

Code:
@ECHO OFF

SET hosttocheck=192.168.0.33

:waitfornetwork

PING -n 1 -w 1000 %hosttocheck% >netcheck.txt

FINDSTR /C:"Packets: Sent = 1, Received = 0, Lost = 1" netcheck.txt >NUL 2>NUL
IF %ERRORLEVEL% == 0 (
   GOTO waitfornetwork
)

FINDSTR /C:"Request timed out." netcheck.txt >NUL 2>NUL
IF %ERRORLEVEL% == 0 (
   GOTO waitfornetwork
)

FINDSTR /C:"Destination host unreachable." netcheck.txt >NUL 2>NUL
IF %ERRORLEVEL% == 0 (
   GOTO waitfornetwork
)

DEL netcheck.txt
SET hosttocheck=

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/