linux - 使用 at 命令从终端自动启动 Firefox

标签 linux terminal scheduled-tasks at-job

我是 Linux 的初学者,非常热衷于学习操作系统。我正在尝试从命令行启动 Firefox(或任何其他软件,如 Evince),如下所示:

[root@localhost ~]# at 1637
[root@localhost ~]# at> firefox
[root@localhost ~]# at> ^d

作业已安排好,没有任何错误。但在指定时间它不运行。 我还尝试给出以下路径:

[root@localhost ~]# at 1637
[root@localhost ~]# at> /usr/bin/firefox
[root@localhost ~]# at> ^d

还是没有结果。但是当我尝试使用 echo 在屏幕上显示文本时,它会根据需要在指定时间出现。可能是什么问题?

最佳答案

我认为您还没有设置DISPLAY。 at 将在未设置显示的单独 shell 中运行。 尝试以下代码。

dinesh:~$ at 2120
warning: commands will be executed using /bin/sh
at>  export DISPLAY=:0
at> /usr/bin/firefox > firefox.log 2>&1
at> <EOT>
job 7 at Tue Mar 11 21:20:00 2014

如果仍然失败,请检查 firefox.log 以获取更多信息。

关于linux - 使用 at 命令从终端自动启动 Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22324065/

相关文章:

linux - UNIX find 命令的奇怪行为

java - 后台java进程不退出

linux - 无法将基于熔断器的卷公开给 Docker 容器

java - 使用自定义代码重新填充缓存而不是 Spring + Quartz 集成

powershell - 从任务计划程序运行的 PowerShell 脚本中的 Msgbox 不起作用

python - 建立大量并行 SSH 连接的 Web 服务器上的脚本,哪种方法更好?

linux - 如何从终端更改文件的 MIME 类型?

macos - applescript 不从终端运行

c - 在我的 Mac 上制作 C 启动器

powershell - 在任务计划程序中传递Powershell参数