Site icon 峰哥分享

The Linux timeout command

Sometimes, you may want to run some network command which may take long time to run. If you want to cancel the command which runs too long, you can use the timeout command.

I use the MPV command to collection some live stream info. The command may stuck when testing a bad url. The timeout command comes handy here.

timeout -k 60 60 mpv –no-video –length=0 –network-timeout=10 “http://edge.music-choice-vc-chaina1.top.comcast.net/VideoChannels/VC-MC128/playlist.m3u8” | grep “Playing\|Video”

https://linux.die.net/man/1/timeout

Exit mobile version