我被雇用使用覆盆子pi在我为高中实习所工作的公司的大厅中创建一种“大厅信息亭”。启动时,树莓派将显示3个项目;演示文稿的不断循环播放的视频,总结了公司的目标和服务,天气以及新闻栏。
为此,我决定使用本地托管的apache2网站,该网站将在引导时以信息亭模式打开。为了提供新闻和天气,我使用了网站小部件。分别来自momentaryreview.com和weatherwidget.io,视频是使用html5标签提供的,其来源是存储在pi上的.mp4文件。为了不断更新新闻和天气,我将网站设置为在每次演示结束时刷新一次,以免破坏循环。我也有一些CSS代码来隐藏滚动条。最后,我设置了一个cronjob以每天午夜重新启动pi。
此设置运行良好,除了每隔一两个小时,网站就会随机崩溃,并显示典型的“糟糕!我们无法访问此网页”错误。错误日志中什么也没有显示,访问日志中也没有异常显示。此外,刷新页面后,一切恢复正常。当然,我当然不需要每两个小时刷新一下信息亭。它必须整天运行,而无需任何干预。是什么原因导致这些崩溃?
在此先感谢您的帮助!
这是我的代码:
<html >
<!--CSS block to set design parameters for the website -->
<style type="text/css">
.WebContainer{
width:100%;
min-width:1850px;
height:100%;
min-height:1075px;
}
html {
min-width: 100%;
min-height: 100%;
}
<!-- sets website dimensions to 1920x1080p;-->
body {
width: 1920px;
height: 1080px;
background-color: #FFF;
}
<!-- makes scrollbar invisible -->
::-webkit-scrollbar {
display: none;
}
</style>
<!--Displays "Welcome to (Company) on top of page & sets background color -->
<body>
<h1 style="text-align:center; font-family:sans-serif;">Welcome to (Company)</h1>
<body style="background-color: skyblue;"></body>
</body>
<!--takes weather information from weatherwidget.io and displays it on the website -->
<a class="weatherwidget-io"
href="https://forecast7.com/en/35d79n78d78/(location)/?unit=us"
data-label_1="LOCATION"
data-label_2="WEATHER"
data-theme="original"
>LOCATION WEATHER</a>
<script>
!function(d,s,id)
{
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id))
{
js=d.createElement(s);js.id=id;
js.src='https://weatherwidget.io/js/widget.min.js';
fjs.parentNode.insertBefore(js,fjs);
}
}
(document,'script','weatherwidget-io-js');
</script>
<!-- takes news from the momentaryreview news widget-->
<iframe
style="background-color: #ffffff;"
src="https://momentaryreview.com/widget"
name="News_widget"
class="iframe"
width="20%"
height="875"
frameborder="1"
marginwidth="0"
marginheight="0"
scrolling="no"
></iframe>
<!-- displays the powerpoint on the website as an mp4; edit these to make the video display normally on smaller screens -->
<video width="1500" height="875" autoplay muted loop>
<source src="IntroPresentationFinal.mp4" type="video/mp4">
</video>
<!-- refreshes the page every loop of the presentation, which is 143 seconds long long -->
<meta
http-equiv="refresh"
content = "142"
>
<body>
</body>
</html>