如果CentOS 7使用的桌面是gnome,可以在終端執行命令
gnome-session-properties
打開Startup Application Preferences(開機啟動應用)配置界面。
按照界面提示,點擊Add,
填寫Name(要配置的程序名稱),command(可執行文件路徑)等信息添加一條配置,即可。
例如,要實現開機啟動FileZilla,使用yum安裝的FileZilla可執行文件路徑為/usr/bin/filezilla,
則Add時,Name可以寫filezilla,command寫/usr/bin/filezilla。
如果操作使用的用戶為admin,以上操作其實是在用戶主目錄下增加了一個配置文件
/home/admin/.config/autostart/filezilla.desktop
文件內容為
[Desktop Entry]
Type=Application
Exec=/usr/bin/filezilla
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=filezilla
Name=filezilla
Comment[en_US]=
Comment=
因此,如要實現開機啟動程序,只需要在用戶主目錄按照上述格式,新建配置文件。
如eclipse(安裝目錄/home/admin/eclipse/)
則配置文件為
/home/admin/.config/autostart/eclipse.desktop
文件內容
[Desktop Entry]
Type=Application
Exec=/home/admin/eclipse/eclipse
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=eclipse
Name=eclipse
Comment[en_US]=
Comment=