当前位置: 首页 >> 榆树网-系统,榆树网-网络 >> 文章正文

Windows下VLC状态检查脚本

原理很简单,假设你的流媒体是20Mbps的,你通过下载程序下载10秒,平均速率如果低于10Mbps,那VLC肯定工作不正常了,把VLC进程杀掉,重新启动VLC即可。

c:
cd \
title CheckNetTraffic

call :sleep 30

set cnt=0

:loop

::zabbix_get -s 127.0.0.1 -k NetOut5 | head -1 | cut -d '.' -f1 > NetOut5.txt

curl -m 10 -o tmpfile.mkv http://localhost:9001 2>&1 | grep Operation | awk "{ print $10*8/$7 ;}" | cut -d. -f1 > NetOut5.tmp.txt
echo 1 >> NetOut5.tmp.txt
cat NetOut5.tmp.txt | head -1 > NetOut5.txt

for /f %%i in (NetOut5.txt) do if %%i LSS 9999 (
taskkill /F /im vlc.exe
set /a cnt+=1
) else set cnt=0

if %cnt% GTR 5 shutdown -r

call :sleep 180

goto loop

:sleep
:: sleep for x number of seconds
ping -n %1 127.0.0.1 > NUL 2>&1
goto :EOF

相关文章

发表评论