Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 在raspberry上,当没有输入流时,我的脚本在循环一段时间后中断_Linux_Bash_Shell_Raspberry Pi3_Omxplayer - Fatal编程技术网

Linux 在raspberry上,当没有输入流时,我的脚本在循环一段时间后中断

Linux 在raspberry上,当没有输入流时,我的脚本在循环一段时间后中断,linux,bash,shell,raspberry-pi3,omxplayer,Linux,Bash,Shell,Raspberry Pi3,Omxplayer,在raspberry上,当没有输入流时,我的脚本在循环一段时间后中断 #!/垃圾箱/垃圾箱 清除 echo-n“框ID:”;sudo cat/proc/cpuinfo | grep Serial | cut-d'-f 2 睡眠2 ping-c1-s1 www.google.com pingStatus=$? 如果[$pingStatus=“0”] 然后 清楚的 echo-n“框ID:”;sudo cat/proc/cpuinfo | grep Serial | cut-d'-f 2 echo“下

在raspberry上,当没有输入流时,我的脚本在循环一段时间后中断

#!/垃圾箱/垃圾箱

清除
echo-n“框ID:”;sudo cat/proc/cpuinfo | grep Serial | cut-d'-f 2
睡眠2
ping-c1-s1 www.google.com
pingStatus=$?
如果[$pingStatus=“0”]
然后
清楚的
echo-n“框ID:”;sudo cat/proc/cpuinfo | grep Serial | cut-d'-f 2
echo“下载频道链接”
RTMP=”rtmp://localhost:1935/live/mystream"    
omxplayer—无密钥$RTMP
./myscript.sh
其他的
清楚的
echo“互联网状态:错误”
echo-n“框ID:”;sudo cat/proc/cpuinfo | grep Serial | cut-d'-f 2
echo“互联网已断开。请检查互联网”
睡眠1
echo“启动频道促销”
睡眠1
omxplayer--o hdmi/home/pi/promo.mp4
./myscript.sh
fi

尝试使用以下命令启动脚本:

bash -x script_name.sh

并在输出中查找错误。

选项'-x'将打开调试,并输出脚本所做的一切。 如果你不能解释它,你可以粘贴在这里

问题可能不在于脚本本身,而在于应用程序在脚本之后死亡 一会儿。这可能是完全正常的,也可能是由于运行异常

您可以捕获omxplayer的输出,如下所示:

omxplayer --no-keys $RTMP 2 > &1 > /var/log/omxplayer.log

这将捕获stdout和stderr输出。如果您无法解释它,则必须使用RTFM。

代码的用途是什么?帮助我们帮助您。您的脚本是否递归调用自身?如果是这样,请使用
exec./myscript.sh
,这样一次只能执行一个版本。@Yonlif如果internet为true,它应该播放我的rtmp链接,当internet关闭时,它应该播放我的promo,完成promo后,它应该再次启动internet检查。当我的流媒体离线时,它只是递归地循环我的脚本,然后错误comingIt改变了我脚本的总输出