Services/Jobs2013/04/27 |
Configure Services and Jobs.
There are the one with Upstart and the one with SysVinit. |
|
[1] | For Upstart one, list all like follows. The one with "start/running" is executed when booting the system. And also the one with "process ***" are the daemon service. |
root@dlp:~# initctl list mountall-net stop/waiting mountnfs-bootclean.sh start/running passwd stop/waiting rc stop/waiting rsyslog start/running, process 1021 screen-cleanup stop/waiting tty4 start/running, process 1079 udev start/running, process 429 upstart-udev-bridge start/running, process 423 ..... ..... |
[2] | For Upstart one, the configration file is under "/etc/init".
Jobs are controled by them. For example, if you'd like to stop "atd" and disable autostart, set like follows. |
root@dlp:~#
initctl stop atd atd stop/waiting
root@dlp:~#
vi /etc/init/atd.conf # make it comment # start on runlevel [2345] |
[3] | For Upstart one, it's possible to know jobs like follows which are executed when booting. And also it's possible to know the meanings for "start on ***" with "man upstart-events". |
root@dlp:~# grep "start on" /etc/init/* /etc/init/acpid.conf:start on runlevel [2345] /etc/init/apport.conf:start on runlevel [2345] /etc/init/atd.conf:#start on runlevel [2345] /etc/init/bootmisc.sh.conf:start on virtual-filesystems /etc/init/checkfs.sh.conf:start on mounted MOUNTPOINT=/ /etc/init/checkroot-bootclean.sh.conf:start on mounted MOUNTPOINT=/ /etc/init/checkroot.sh.conf:start on mounted MOUNTPOINT=/ /etc/init/console.conf:start on stopped rc RUNLEVEL=[2345] and container CONTAINER=lxc /etc/init/console-font.conf:start on starting plymouth-splash ..... .....root@dlp:~# man upstart-events Table 1: Well-Known System Events Summary. |-----------------------------------------------------------------------------| |Ref | Event | Type | Emit | Time | Note | |-----------------------------------------------------------------------------| | | all-swaps | S | M | > (5) | | | | control-alt-delete(7) | S | A | > (5) | A | | | container | S | C | > /run mounted | Q | | | dbus-activation | S | B | > D-Bus client request | | | | deconfiguring-networking | H | V | < non-local IFs down | P | | | desktop-session-start | H | D | > X(7) session created | B | | | desktop-shutdown | H | D | > X(7) session ended | O | | | device-not-ready | H | M | > (2) | N | | | drm-device-added | S | U | > (5) | C | | | failsafe-boot | S | X | > (7) and local IF | S | | | file | S | K | > (1) | U | | 7 | filesystem | S | M | After last (1) | D | | | graphics-device-added | S | U | > (5) | C | | | keyboard-request(7) | S | A | > (5) | E | | | local-filesystems(7) | S | M | > (6) | | | | login-session-start | H | D | < DM running | F | | 1 | mounted(7) | H | M | > associated (2) | G | | 2 | mounting(7) | H | M | > (5) | H | | 3 | net-device-added | S | U | > (5) | C | | | net-device-changed | S | U | > (5) | C | | | net-device-down | S | F | < (4) | C | | 4 | net-device-removed | S | U | > (5) | C | | | net-device-up | S | F,N | > (3) | C | | | not-container | S | C | > /run mounted | Q | | | power-status-changed(7) | S | I | > (5) | I | | | recovery | S | G | Boot (<5) | R | | | remote-filesystems(7) | S | M | > (6) | | | | runlevel(7) | M | T | > (7) + (8) | | | | socket(7) | S | S | > socket connection | | | 5 | startup(7) | S | I | Boot | J | | | started(7) | S | I | > job started | K | | | starting(7) | H | I | < job starts | K | | 8 | static-network-up | S | N | > last static IF up | | | | stopped(7) | S | I | > job stopped | K | | | stopping(7) | H | I | < job stops | K | | | unmounted-remote- | H | V | > last remote FS | L | | | filesystems | | | unmounted | | | 6 | virtual-filesystems(7) | S | M | > last virtual FS (1) | M | |-----------------------------------------------------------------------------| Table 2: Well-Known User Events Summary. |------------------------------------------------------------------------------| |Ref | Event | Type | Emit | Time | Note | |------------------------------------------------------------------------------| | | desktop-end(7) | S | J | < (2) | | | | desktop-start(7) | H | J | > (3) | | | | file | S | K | > (1) | U | | 2 | session-end(7) | M | I | < Session Init end | | | 1 | startup(7) | S | I | > Session Init start | J | | | :sys:* | S | E | > upstart-event-bridge(8) start | | | 3 | xsession | M | H | > (1) | T | |------------------------------------------------------------------------------| Table 3: Event Types. |-------------------------------------------------| |Ref | Event Type | Notes | |-------------------------------------------------| | H | Hook | Blocking. Waits for events | | | | that start on or stop on this | | | | event. | | M | Method | Blocking task. | | S | Signal | Non-blocking. | |-------------------------------------------------| Table 4: Event Emitters. |-------------------------------------------------------------------------| |Ref | Emitter | Notes | |-------------------------------------------------------------------------| | A | System Administrator (initiator) | Technically emitted by init(8). | | B | dbus-daemon(1) | Run with "--activation=upstart" | | C | container-detect job | | | D | Display Manager | e.g. lightdm/gdm/kdm/xdm. | | E | upstart-event-bridge(8) | | | F | ifup(8) or ifdown(8) | See /etc/network/. | | G | bootloader or initramfs | | | H | xsession-init session job | | | I | init(8) | Either PID 1 or a Session Init. | | J | job that starts desktop | gnome-session job for Ubuntu. | | K | upstart-file-bridge(8) | | | M | mountall(8) | | | N | network-interface job | | | S | upstart-socket-bridge(8) | | | T | telinit(8), shutdown(8) | | | U | upstart-udev-bridge(8) | | | V | System V init system | | | X | failsafe job | | |-------------------------------------------------------------------------| Table 5: Event Summary Notes. |-----------------------------------------------------------------------| |Note | Detail | |-----------------------------------------------------------------------| | A | Requires administrator to press Control-Alt-Delete key combina- | | | tion on the console. | | B | Event generated when user performs graphical login. | | C | These are specific examples. upstart-udev-bridge(8) will emit | | | events which match the pattern, "S-device-A" where 'S' is the | | | udev subsystem and 'A' is the udev action. See udev(7) and for | | | further details. If you have sysfs mounted, you can look in | | | /sys/class/ for possible values for subsystem. | | D | Note this is in the singular - there is no 'filesystems' event. | | E | Emitted when administrator presses Alt-UpArrow key combination | | | on the console. | | F | Denotes Display Manager running (about to be displayed), but no | | | users logged in yet. | | G | Generated for each mount that completes successfully. | | H | Emitted when mount attempt for single entry from fstab(5) for | | | any filesystem type is about to begin. | | I | Emitted when Upstart receives the SIGPWR signal. | | J | Initial event (system or Session Init). | | K | Although the events are emmitted by init(8), the instigator may | | | be initctl(8) if a System Administrator has manually started or | | | stopped a job. | | L | /etc/init/umountnfs.sh. | | M | Emitted when all virtual filesystems (such as /proc) mounted. | | N | Emitted when the --dev-wait-time timeout is exceeded for moun- | | | tall(8). This defaults to 30 seconds. | | O | Emitted when the X(7) display manager exits at shutdown or | | | reboot, to hand off to the shutdown splash manager. | | P | Emitted by /etc/init.d/networking just prior to stopping all | | | non-local network interfaces. | | Q | Either 'container' or 'not-container' is emitted (depending on | | | the environment), but not both. | | R | Emitted by either the initramfs or bootloader (for example | | | grub) as the initial event (rather than startup(7)) to denote | | | the system has booted into recovery mode. If recovery was suc- | | | cessful, the standard startup(7) event is then emitted, allow- | | | ing the system to boot as normal. | | S | Emitted to indicate the system has failed to boot within the | | | expected time. This event will trigger other jobs to forcibly | | | attempt to bring the system into a usable state. | | T | Only emitted for a graphical session. | | U | See file-event(7). | |-----------------------------------------------------------------------| |
[4] | For SysVinit one, for example, NTP, it's easy to manage them to install a tool like follows. |
root@dlp:~#
aptitude -y install sysv-rc-conf
root@dlp:~#
root@dlp:~# sysv-rc-conf --list # list services sysv-rc-conf ntp on # set auto-start for NTP root@dlp:~# sysv-rc-conf ntp off # disable auto-start for NTP |
Sponsored Link |