開機后用戶登錄后啟動 且有快捷方式和開始菜單
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 停止服務