debian系統開機

之前的開機相關資訊都是放在linux系統設定,現在整理出來再加入新資料

========================================

開機執行命令
insserv script
移除開機執行命令
insserv -r script

=======================================
Debian
從6.0 開始 insserv 取代 update-rc.d
Mint

 /usr/lib/insserv/insserv

=======================================
Ubuntu
upstart
upstart events
不是很確定?(實驗)
start on drm-device-added (在文字介面)
start on desktop-session-start (有圖形介面)
start on started dbus (掛載 btrfs)

 description    "Mount virtualbox shared folder filesystems"

start on desktop-session-start

console output

script
 exec /bin/mount -t vboxsf -o uid=1000 home2 /home2
 end script
 

=======================================
20150810
不讓 upstart 某些服務開機執行

$ sudo echo "manual" >> /etc/init/myjob.override

========================================

systemed

Debian jessie,Ubuntu 15.04 以後版本,初始開機init預設使用systemd

範例

[Unit]
Description=Job that runs the foo daemon

[Service]
Type=forking
Environment=statedir=/var/cache/foo
ExecStartPre=/usr/bin/mkdir -p ${statedir}
ExecStart=/usr/bin/foo-daemon --arg1 "hello world" --statedir ${statedir}

[Install]
WantedBy=multi-user.target

測試語法

systemd-analyze verify /path/to/foo.service

連結放置位置

ln -s /path/to/foo.service /etc/systemd/system/foo.service

 

參考資料:
SystemdForUpstartUsers
Convert “run at startup” script from upstart to systemd for Ubuntu 16
init演化歷程 – [轉貼] 淺析 Linux 初始化 init 系統,第 3 部分: Systemd

This entry was posted in 系統管理. Bookmark the permalink.