試過修改/etc/rc.local檔案,但是啟動無效。
目前試過行之有效的方式如下:
參考:在終端執行 gnome-session-properties命令
新增之後
這樣的方式對於需要root許可權的程式來說,無法獲取許可權。
可以使用以下指令碼, 上面gnome啟動該指令碼,這樣啟動的processmoniter就有root許可權了:
#!/bin/sh### begin init info
# provides: land.
sh# required-start: $local_fs $remote_fs $network $syslog
# required-stop: $local_fs $remote_fs $network $syslog
# default-start: 234
5# default-stop: 016
# short-description: starts the svnd.sh
daemon
# description: starts svnd.
sh using start-stop-daemon
### end init info
#任務指令碼
#進入要執行指令碼目錄
cd "
$(dirname
"$0")"
#取得root許可權,
'admin
'為密碼,不用加引號,'ls'
無實際作用
echo admin|sudo -s ls
#執行指令碼./bin/mywork,sudo -s需要加上
sudo -s ./processmoniter
#任務指令碼
ubuntu16 04自啟動指令碼
四 輸密碼sudo s 五 可執行檔案 進入到 etc init.d 目錄下編寫指令碼。cd etc init.d sudo gedit hello.sh 比如自啟動chrome瀏覽器 bin bash begin init info provides hello required start lo...
ubuntu16 04服務自啟動(彈控制台)
一 設定root桌面使用者登入 1 vim usr share lightdm lightdm.conf.d 50 ubuntu.conf 在最後一行新增greeter show manual login true 2 修改root使用者配置檔案 vim root profile 修改mesg n ...
Ubuntu16 04如果設定開機啟動
開啟rc local.servicecd lib systemd system sudo vim rc local.service開啟後看到如下內容 unit description etc rc.local compatibility conditionfilei ecutable etc rc....