簡體   English   中英

在CentOS上登錄后如何啟動應用程序?

[英]How to start application after login on CentOS?

我正在嘗試使用CentOS上的upstart腳本啟動GUI應用程序。 我的測試腳本位於/ etc / init /文件夾中。

start on desktop-session-start
stop on desktop-shutdown

respawn

script
export DISPLAY=:0
sleep 5
exec /.1/Projects/UpstartTest/start.sh &

end script

start.sh腳本正在運行GUI應用程序的二進制文件。

重新啟動我的計算機后。 當我輸入時:

[root@mg-CentOS ~]# initctl status test
test stop/waiting

因此,我的暴發戶不是流氓。 當我鍵入

initctl start test

手動它可以正常工作,沒有任何問題。

用戶登錄(桌面啟動)后如何運行該新貴腳本? 我正在嘗試查找有關CentOS的詳細文檔,但沒有。

為此,您可以使用在Linux發行版中內置的update-rc工具。 它基本上在文件夾rc.X上為要在啟動時執行的腳本或其他某些OS狀態創建符號鏈接,其中X是確定所需狀態的文件夾的編號。

您可能需要看看以下答案: Update-rc.d自定義腳本運行得太晚了,並且在關機時也運行

有關更多信息,請參見: http : //www.linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts

有關CentOS引導過程的詳細信息可以在這里找到: https : //www.centos.org/docs/5/html/Installation_Guide-zh-CN/s1-boot-init-shutdown-process.html ; rc也在本文檔中進行了說明。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM