我已经与这个问题斗争了三天,我尝试了很多方法来解决它,但还没有成功。我希望你们能帮助我...
我有一个 GUI 应用程序。我想自动启动这个应用程序。当它意外关闭或关闭时,我想重新打开此应用程序。
我尝试使用 upstart 脚本,但是尽管 upstart 的服务没有问题,但 GUI 应用程序并未以 upstart 脚本启动。它说无法连接 X 服务器。
我应该添加或更改一些设置以使用 upstart 打开还是有任何方法可以在发生意外退出或关闭时自动打开 GUI 应用程序(不仅仅是登录后一次,我的意思是不是使用 Startup)?
创建文件 $HOME/.config/upstart/myGuiStart.conf
内容:
start on desktop-start
stop on desktop-end
respawn
exec firefox
Run Code Online (Sandbox Code Playgroud)
或另一个延迟的例子:
start on desktop-start
stop on desktop-end
respawn
script
sleep 30
firefox
end script
Run Code Online (Sandbox Code Playgroud)
重生说明:
respawn
A service or task with this stanza will be automatically started
if it should stop abnormally. All reasons for a service stopping,
except the stop(8) command itself, are considered abnormal. Tasks
may exit with a zero exit status to prevent being respawned.
Run Code Online (Sandbox Code Playgroud)
更多信息:
http://ifdeflinux.blogspot.de/2013/04/upstart-user-sessions-in-ubuntu-raring.html
重生错误?-> https://askubuntu.com/a/62461/265974