我有一个基于java的gui程序,我可以在终端上运行,而无需使用:
$ /home/user1/ibg/ibg username=***password=***
通过上面的命令,程序gui显示出来,自动登录到我的在线帐户,我可以通过端口4002用python脚本与他们的服务器通信,成功请求数据。没问题。
我想使用 systemd
在ubuntu中。我写的服务文件如下(放在 /etc/systemd/system
):
[Unit]
Description=ibg service
After=network.target
[Service]
Type=simple
Environment=DISPLAY=:0
ExecStart=/home/user1/ibg/ibg username=****password=****
[Install]
WantedBy=multi-user.target
但是,服务无法成功运行。
user1@SFO:~$ sudo systemctl status ibg.service
● ibg.service - ibg service
Loaded: loaded (/etc/systemd/system/ibg.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-08-18 22:13:07 PDT; 3s ago
Process: 27951 ExecStart=/home/user1/ibg/ibg username=****password=****(code=exited, status=1/FAILURE)
Main PID: 27951 (code=exited, status=1/FAILURE)
Aug 18 22:13:07 SFO ibg[27951]: at java.security.AccessController.doPrivileged(Native Method)
Aug 18 22:13:07 SFO ibg[27951]: at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
Aug 18 22:13:07 SFO ibg[27951]: at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
Aug 18 22:13:07 SFO ibg[27951]: at java.awt.EventQueue.invokeLater(EventQueue.java:1266)
Aug 18 22:13:07 SFO ibg[27951]: at com.exe4j.runtime.LauncherEngine.handleFailure(LauncherEngine.java:140)
Aug 18 22:13:07 SFO ibg[27951]: at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:94)
Aug 18 22:13:07 SFO ibg[27951]: at com.install4j.runtime.launcher.UnixLauncher.start(UnixLauncher.java:66)
Aug 18 22:13:07 SFO ibg[27951]: at install4j.ibg.GWClient.main(Unknown Source)
Aug 18 22:13:07 SFO systemd[1]: ibg.service: Main process exited, code=exited, status=1/FAILURE
Aug 18 22:13:07 SFO systemd[1]: ibg.service: Failed with result 'exit-code'.
有人能帮我找到问题所在吗?status命令不提供服务无法运行的原因。有没有办法获得更多的失败信息?运行命令行版本的gui和我创建的服务有什么区别?我使用完全相同的命令来运行它 ExecStart
.
暂无答案!
目前还没有任何答案,快来回答吧!