/home/matthew/@/Sync/FreeFileSync "/home/matthew/@/Sync/Backup.ffs_batch"
如果我手动运行上面的代码,它就会正常工作,但是如果我通过以下服务运行它,它就不会工作了:
matthew@matthew-pc:~$ cat /lib/systemd/system/Testing1.service
[Service]
ExecStart=/home/matthew/@/Sync/FreeFileSync "/home/matthew/@/Sync/Backup.ffs_batch"
[Install]
WantedBy=multi-user.target
错误如下所示:
matthew@matthew-pc:~$ sudo systemctl status Testing1.service
[sudo] password for matthew:
● Testing1.service
Loaded: loaded (/lib/systemd/system/Testing1.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-07-09 14:14:33 HKT; 1s ago
Process: 10255 ExecStart=/home/matthew/@/Sync/FreeFileSync /home/matthew/@/Sync/Backup.ffs_batch (code=exited, status=25
Main PID: 10255 (code=exited, status=255)
Jul 09 14:14:33 matthew-pc systemd[1]: Started Testing1.service.
Jul 09 14:14:33 matthew-pc FreeFileSync[10255]: 14:14:33: Error: Unable to initialize GTK+, is DISPLAY set properly?
Jul 09 14:14:33 matthew-pc systemd[1]: Testing1.service: Main process exited, code=exited, status=255/n/a
Jul 09 14:14:33 matthew-pc systemd[1]: Testing1.service: Failed with result 'exit-code'.
如何解决"Error:无法初始化GTK+,显示设置是否正确?“
发布于 2019-07-13 20:35:33
遵循以下步骤:
/etc/systemd/user
。为此执行mv /etc/systemd/system/Testing1.service /etc/systemd/user/
。systemctl --user start Testing1.service
来启动服务。解释系统有两种运行模式,即系统模式和用户模式。系统模式是在用户登录到其会话之前启动的,因此此时没有图形会话。FreeFileSync和ReadTimeSync需要访问图形X11显示,因此它们不能通过系统模式运行。在用户模式下,系统了解并使用用户图形化会话(如果执行命令的shell属于用户及其图形环境,则为<#>only)。更多细节可以找到在ArchWiki中或论叠加流。
https://unix.stackexchange.com/questions/529115
复制相似问题