在Ubuntu18.04 利用systemctl 添加桌面应用程序开机自启动失败
name.service 内容
Unit
Description= app serive
After=network.target
Service
WorkingDirectory=/home/
ExecStart=/home/name.sh
ExecStop=
ExecReload=
Type=simple
Install
WantedBy=graphical.target
、、脚本内容
exec ${ROOT_PATH}/执行程序
在终端输入 systemctl status name.service 显示
Unable to init server: 无法连接: 拒绝连接
12月 10 17:17:20 17时17分20秒: Error: Unable to initialize GTK+, is DISPLAY s
12月 10 17:17:20 name.service: Main process exited, code=exited, status=255/n/a
12月 10 17:17:20 systemd[1]:name.service: Failed with result 'exit-code'.
利用 gnome-session-properties 可以实现 但我想用脚本的方式启动
开机后自动启动桌面应用程序