linux 系统应用程序桌面图标显示及进程自启动

开机后用户登录后启动  且有快捷方式和开始菜单

cp test.desktop $RPM_BUILD_ROOT/usr/share/applications/    桌面快捷方式及开始菜单显示,登录用户后自启动 (所属当前登录用户)

cp test.desktop $RPM_BUILD_ROOT/etc/xdg/autostart/            开机登录用户后自启动 (所属当前登录用户)

 test.desktop 文件内容如下: 

[Desktop Entry]
Name=系统
Name[zh_CN]=系统
Comment=Client
Exec=/opt/test.exec
Icon=/opt/res/tray.png
Terminal=false
Type=Application
Categories=System
Encoding=UTF-8
StartupNotify=true

 

开机自启动

/etc/systemd/system/multi-user.target.wants/test.service -> /lib/systemd/system/test.service       开机自启动(所属root用户)

 /lib/systemd/system/test.service 文件内容如下: 

[Unit]
Description=test Service

[Service]
Type=simple
ExecStart=/opt/test
StandardOutput=null

[Install]
WantedBy=multi-user.target graphical.target

systemctl start test.service  启动服务

systemctl stop test.service  停止服务

posted @ 2019-09-29 17:33  wjbooks  阅读(1700)  评论(0编辑  收藏  举报