简体   繁体   English

Raspberry Pi刷新浏览器

[英]Raspberry Pi Refresh Browser

I have a raspberry pi set up to act as a signage system using a google presentation url as what its displaying. 我设置了一个树莓派,用作使用Google演示文稿网址作为其显示内容的标牌系统。 Problem is I need this page to be refreshed every 5 minutes to grab new information added or removed from the slideshow. 问题是我需要每5分钟刷新一次此页面,以获取在幻灯片中添加或删除的新信息。

What I had set up was a small cron job running every 5 minutes 我设置的是每5分钟运行一次小型cron作业

*/5 * * * * export DISPLAY=:0 && /bin/bash /home/pi/refresh.sh 
[xdotool search “Chromium” windowactivate --sync key F5] <- Contents of refresh.sh

However as I have noticed from watching the display it is not auto refreshing and if I run that command manually from ssh it refreshes just fine. 但是,正如我从观看显示中注意到的那样,它不是自动刷新的,如果我从ssh手动运行该命令,则刷新就很好。

Does anybody have any tips? 有人有提示吗? Maybe I'm missing something? 也许我缺少什么?

I actually got it to work by modifying the refresh.sh with 我实际上是通过修改refresh.sh使其起作用的

sudo -u pi screen -d -m export DISPLAY=:0 && xdotool search "Chromium" windowactivate --sync key F5 > /dev/null 2>&1

I guess the cronjob runs under a separate shell that when it tried to fetch the display with xdotool it wasn't able to. 我猜想cronjob在一个单独的外壳下运行,当它尝试使用xdotool来获取显示内容时却无法执行。 With this the cron job actually fires up a shell as the pi user and then executes the xdotool which then runs the command like it should and then once that command is done the screen session dies. 这样,cron作业实际上会以pi用户的身份启动外壳程序,然后执行xdotool,然后按应有的方式运行命令,然后一旦完成该命令,屏幕会话就会终止。 Effectively doing exactly what I needed for the digital sign. 有效地做我所需的数字标牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM