2,958 瀏覽數

Ubuntu Upstart

我們來看看 Ubuntu 採用 Upstart (新的 init)之後做了哪一些改變,關於 upstart 請先參考 http://benjr.tw/10578

Ubuntu 16.04 也採用 systemd 的方式來啟動,管理則是改成 systemctl – http://benjr.tw/94315

透過 #apt-catch show 可以查看 upstart 套件提供哪一些工具.

root@ubuntu:~# apt-cache show upstart

Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job

可以清楚看到 sysvinit 已經被取代,不再提供.取而代之的是 startup-tasks, system-services, upstart-compat-sysv, upstart-job 這些工具.

網路上可以查到這幾個內容的主要功用.
startup-tasks : 提供了系統啟動任務的工作定義文件。
system-services : 提供了 tty 服務的工作定義文件。
upstart-compat-sysv : 提供了 rc 任務的工作定義文件,並提供了 reboot, runlevel, shutdown, telinit 等工具,以便與 sysvinit 相兼容。
upstart-job : 提供Upstart init daemon 和 initctl 工具。

我們來看看他們提供哪一些功能,我們可以透過 #apt-file (需要額外安裝 #apt-get install apt-file ,更多 apt 指令使用請參考 http://benjr.tw/93967)

root@ubuntu:~# apt-get install apt-file
root@ubuntu:~# apt-file update

現在我們來看看 upstart 提供了哪一些功能.#apt-file show upstart 會找出所有跟 upstart 相關的套件.我這邊只列出跟 upstart 這個套件的內容.

root@ubuntu:~# apt-file show upstart
upstart: /bin/running-in-container

???

upstart: /etc/X11/Xsession.d/00upstart
upstart: /etc/X11/Xsession.d/99upstart

???

upstart: /etc/bash_completion.d/upstart
upstart: /etc/cron.daily/upstart

這些都是關於 upstart 的設定檔.

upstart: /etc/dbus-1/system.d/Upstart.conf
upstart: /etc/init/console.conf
upstart: /etc/init/container-detect.conf
upstart: /etc/init/control-alt-delete.conf
upstart: /etc/init/failsafe.conf
upstart: /etc/init/flush-early-job-log.conf
upstart: /etc/init/rc-sysinit.conf
upstart: /etc/init/rc.conf
upstart: /etc/init/rcS.conf
upstart: /etc/init/shutdown.conf
upstart: /etc/init/tty1.conf
upstart: /etc/init/tty2.conf
upstart: /etc/init/tty3.conf
upstart: /etc/init/tty4.conf
upstart: /etc/init/tty5.conf
upstart: /etc/init/tty6.conf
upstart: /etc/init/upstart-file-bridge.conf
upstart: /etc/init/upstart-socket-bridge.conf
upstart: /etc/init/upstart-udev-bridge.conf
upstart: /etc/init/wait-for-state.conf
upstart: /etc/logrotate.d/upstart
upstart: /etc/upstart-xsessions

???

upstart: /lib/init/apparmor-profile-load
upstart: /lib/init/upstart-job

雖然可以看到 upstart 提供很多工具可供使用,但 reload, restart, start, status, stop 都是 initctl 的連結.halt與 poweroff 都是 reboot 的連結.更多關於 initctl 請參考 http://benjr.tw/94015

upstart: /sbin/init
upstart: /sbin/reboot
upstart: /sbin/halt
upstart: /sbin/poweroff
upstart: /sbin/initctl
upstart: /sbin/reload
upstart: /sbin/restart
upstart: /sbin/start
upstart: /sbin/status
upstart: /sbin/stop
upstart: /sbin/runlevel
upstart: /sbin/shutdown
upstart: /sbin/telinit

???

upstart: /sbin/upstart-dbus-bridge
upstart: /sbin/upstart-event-bridge
upstart: /sbin/upstart-file-bridge
upstart: /sbin/upstart-local-bridge
upstart: /sbin/upstart-socket-bridge
upstart: /sbin/upstart-udev-bridge
upstart: /usr/bin/init-checkconf
upstart: /usr/bin/initctl2dot
upstart: /usr/lib/upstart/migrate-inittab.pl

???

upstart: /usr/share/apport/package-hooks/upstart.py

關於 upstart 的參考說明文件.

upstart: /usr/share/doc/upstart/AUTHORS
upstart: /usr/share/doc/upstart/HACKING.gz
upstart: /usr/share/doc/upstart/NEWS.gz
upstart: /usr/share/doc/upstart/README.Debian.gz
upstart: /usr/share/doc/upstart/TODO.gz
upstart: /usr/share/doc/upstart/changelog.Debian.gz
upstart: /usr/share/doc/upstart/copyright

man page 說明文件,可以透過 man (如 #man init ) 來檢視這一些文件說明.

upstart: /usr/share/man/man5/init.5.gz
upstart: /usr/share/man/man5/inittab.5.gz
upstart: /usr/share/man/man7/control-alt-delete.7.gz
upstart: /usr/share/man/man7/dbus-event.7.gz
upstart: /usr/share/man/man7/drm-device-added.7.gz
upstart: /usr/share/man/man7/file-event.7.gz
upstart: /usr/share/man/man7/graphics-device-added.7.gz
upstart: /usr/share/man/man7/keyboard-request.7.gz
upstart: /usr/share/man/man7/net-device-added.7.gz
upstart: /usr/share/man/man7/net-device-removed.7.gz
upstart: /usr/share/man/man7/power-status-changed.7.gz
upstart: /usr/share/man/man7/runlevel.7.gz
upstart: /usr/share/man/man7/session-end.7.gz
upstart: /usr/share/man/man7/socket-event.7.gz
upstart: /usr/share/man/man7/started.7.gz
upstart: /usr/share/man/man7/starting.7.gz
upstart: /usr/share/man/man7/startup.7.gz
upstart: /usr/share/man/man7/stopped.7.gz
upstart: /usr/share/man/man7/stopping.7.gz
upstart: /usr/share/man/man7/upstart-events.7.gz
upstart: /usr/share/man/man7/upstart.7.gz
upstart: /usr/share/man/man8/halt.8.gz
upstart: /usr/share/man/man8/init-checkconf.8.gz
upstart: /usr/share/man/man8/init.8.gz
upstart: /usr/share/man/man8/initctl.8.gz
upstart: /usr/share/man/man8/initctl2dot.8.gz
upstart: /usr/share/man/man8/poweroff.8.gz
upstart: /usr/share/man/man8/reboot.8.gz
upstart: /usr/share/man/man8/reload.8.gz
upstart: /usr/share/man/man8/restart.8.gz
upstart: /usr/share/man/man8/runlevel.8.gz
upstart: /usr/share/man/man8/shutdown.8.gz
upstart: /usr/share/man/man8/start.8.gz
upstart: /usr/share/man/man8/status.8.gz
upstart: /usr/share/man/man8/stop.8.gz
upstart: /usr/share/man/man8/telinit.8.gz
upstart: /usr/share/man/man8/upstart-dbus-bridge.8.gz
upstart: /usr/share/man/man8/upstart-event-bridge.8.gz
upstart: /usr/share/man/man8/upstart-file-bridge.8.gz
upstart: /usr/share/man/man8/upstart-local-bridge.8.gz
upstart: /usr/share/man/man8/upstart-socket-bridge.8.gz
upstart: /usr/share/man/man8/upstart-udev-bridge.8.gz
upstart: /usr/share/upstart/sessions/logrotate.conf
upstart: /usr/share/upstart/sessions/re-exec.conf
upstart: /usr/share/upstart/sessions/upstart-dbus-session-bridge.conf
upstart: /usr/share/upstart/sessions/upstart-dbus-system-bridge.conf
upstart: /usr/share/upstart/sessions/upstart-event-bridge.conf
upstart: /usr/share/upstart/sessions/upstart-file-bridge.conf
upstart: /usr/share/upstart/sessions/xsession-init.conf

利用 #dpkg –listfiles upstart 也一樣可以查這一些資料.

root@ubuntu:~# dpkg --listfiles upstart

網友的想法

  1. 自動參照通知: Upstart | Benjr.tw

發表迴響