ReadyView NVR locking up 3rd-party cameras

I noticed my streams on my 3rd-party RTSP cameras were constantly losing connections. In order to be able to reinitialize the feed I had to power them off. I did some investigating on the hardware in the camera and I noticed the NVR was creating hundreds of connections with the camera service and leaving them unterminated. Port 554 has hundreds of CLOSE_WAIT from the WD ReadyView NVR. I ran a script command to terminate the CLOSE_WAIT state from the NVR and the feeds began streaming again.

OK, help a guy who knows just a little about Ubuntu and Unix code. How do I open terminal and run a script as you describe inside nvr os ?