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  停止服务


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM