gpt4 book ai didi

linux - 使用 watch 每 N 秒更新一次在 linux 中显示的图像失败

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:34:47 26 4
gpt4 key购买 nike

我有一些代码可以在服务器上自动生成机器学习图,并在适当的时间将图发送到物联网客户端进行显示。

数据管道工作。但是,我尝试在推送新情节时近乎实时地更新图像,但没有奏效。

目前我的做法是:

user@client:~/data_viz $ watch -n3 feh -F plot0.png --zoom 200

其中 feh 是一些任意的轻量级 Linux 图像查看器。

问题是即使文件 (plot0.png) 被成功覆盖,查看器也不会更新,直到您杀死它并重新启动它。

更新:我用下面的 Bash 方法实现了世界上最糟糕的版本。现在唯一的问题是它每秒都在闪烁桌面,如果我不解决这个问题,无疑会导致癫痫发作...

$ watch -n2 sudo bash watch.sh

watch.sh 在哪里

#!/bin/bash
i="0"
while [ $i -lt 4 ]
do
pkill feh
sleep 1
feh -F plot0.png --zoom 200&
sleep 1
pkill feh
done

即使使用 Esc 和 ctrl+c,似乎也没有办法真正打破无限循环。我希望循环是无限的,但我也希望能够在必要时中断它。

最佳答案

同时 feh ,像大多数图像查看器/编辑器一样,不会观察图像文件的变化并在发生变化时自动重新加载,它确实提供了 -R, --reload <int>将导致 feh 的选项在指定为 <int> 的秒数后重新加载图像发散。例如:

feh --reload 5 image.png

会导致feh重新加载 image.png每个5秒。 man 1 feh解释:

-R, --reload <int>

Reload filelist and current image after int seconds. Useful for viewing
HTTP webcams or frequently changing directories. (Note that the filelist
reloading is still experimental.)

If an image is removed, feh will either show the next one or quit.
However, if an image still exists, but can no longer be loaded, feh
will continue to try loading it.

关于linux - 使用 watch 每 N 秒更新一次在 linux 中显示的图像失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50892932/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com