2010-01-12 13 views
0

對不起,我的英語(我RUS)通過定時器限制WGET'ing,如何做到這一點?

我從IP攝像機保存MJPEG流與wget的

wget -O 2010-01-12_01.mjpeg http://172.16.1.220:8070/video.mjpg 

我按小時需要限制儲蓄(每小時是另一個文件 - 2010年01期-12_ [XX])

什麼是最簡單的方法呢? 1)由cron啓動和查殺? 2)for ..在腳本中做,怎麼樣? ...

感謝答案

回答

1

爲什麼不直接使用wget的超時參數?

-T seconds 
--timeout=seconds 

將網絡超時設置爲秒秒。這相當於同時指定--dns-timeout,--connect-timeout和--read-timeout。

+0

我認爲這是最好的 – bymaker 2010-01-12 10:07:13

+0

但doen't工作:) – bymaker 2010-01-12 10:10:29

+0

--timeout作爲名字說,超時,又名,最大重試/等待發生錯誤時。它不會按照OP的要求強制下載最長時間。 – Florian 2010-01-12 10:28:27

1

我會使用這樣的:

(wget ... & sleep 3600; kill %1) 
0

甜如bash的雜牌

wget whatever & 
sleep 60 && kill $$ 2>/dev/null 
0

只是另一種方法來wget的

while [ "true" ]; do 
ffmpeg -t 3600 -i http://172.16.1.220:8070/video.mjpg -vcodec mjpeg /path/to/storage/$(date +%Y-%m-%d_%H).mjpg 
done 
-1

嘗試curl-m--max-time選項

+1

請給你的答案添加一個完整的例子 – tttthomasssss 2014-09-12 18:21:50

0

可以使用超時實用程序:

timeout 3600 wget -O `date +%Y-%m-%d_%T`.mjpeg http://172.16.1.220:8070/video.mjpg