Question | Answer |
The process of specifying whether specific daemons start at a specified runlevel | Init Script Configuration |
init scripts System V distro stored in: | /etc/rc.d/init.d |
init scripts BSD distro (SUSE) stored in: | /etc/init.d |
init scripts Facts: | Have symbolic links that are stored in sub-directories that correspond to the runlevel under which each script should start |
init scripts Facts: | 1. Are started at boot using the init script.
2. Can be started and stopped manually. |
init scripts Facts: | Have code in the scripts that determine the appropriate runlevels on which the script can operate. Configuration commands use this info to configure the appropriate levels at which scripts can start and stop |
The init script code includes | 1. Default-start line ( services starts by default).
2. Required-start line (must be running).
3. Should-start line (recommended) |
Init scripts directories other scripts: Switches between runlevels (BSD and System V) | rc |
Init scripts directories other scripts: Stops and reboots the computer (when init 0 or 6 invoked)(BSD and System V) | halt |
Init scripts directories other scripts: Run by the init process when computer starts (BSD only) | boot |
Init scripts directories other scripts: Run by the init process when computer starts (System V only) | rc.sysinit |
Init scripts directories other scripts: Runs specific tasks at startup as specified by the administrator (BSD only) | boot.local |
Init scripts directories other scripts: Runs specific tasks at startup as specified by the administrator (System V only) | rc.local |
boot (BSD) and rc.sysinit scripts perform the following tasks: | 1. Load the kernel module.
2. Checking the file system.
3.Setting the system clock |
At boot time init uses the ----- file to determine the default runlevel, such as runlevel 5 | /etc/inittab |
When a runlevel is specified in /etc/inittab: | init looks at the directory associated with the runlevel to determine what processes to start. |
The directory for runlevel 5 is: | rc5.d - additional directories named rc0.d through rc6.d specify what processes to start for each runlevel |
Each rc directory contains SYMBOLIC links that: | Point to a specific init script |
Link names in rc0.d through rc6.d directories starting with an S: | Start a script for the runlevel - init follows the links and starts the process |
Link names in rc0.d through rc6.d directories starting with an K | Kill a running process when the computer changes runlevels. - init follows the links and stops the process |
When a runlevel changes init | repeats the process using the appropriate rc directory - follows the sysmbolic links |
Command to manage the current state of a daemon | service |
Service options include: Start a daemon that is not currently running | start |
Halt a running daemon | stop |
service Options include: Request that a daemon read and apply its configuration files without stopping (implement a new configuration) | reload |
service Options include: Stop and restart a daemon | restart |
service Options include: Show the state of a single daemon | status |
service Options include: Show the state of all daemons | --status-all |
service Option Example: Reload the daemon | service reload |
service Option Example: using ABSOLUTE PATH to the daemon to start it (System V only) | /etc/rc.d/init.d/ start |
service Option Example: using ABSOLUTE PATH to the daemon to start it (BSD only) | /etc/init.d/ start |
References the INIT INFO script section of each daemon to determine the default runlevels for the daemon and dependent daemons (BSD only) | insserv - configures default runlevels for a daemon |
insserv Options: Starts at the runlevels specified in the init BLOCK script code | insserv script_name.
insserv |
insserv Options: Keep a script from starting at any runlevel | insserv -r |
insserv Options: Restores a daemon to the default runlevels defined in the scripts | insserv -d |
Configure default runlevels for a daemon (on a System V distribution) | chkconfig |
chkconfig Options: Add a new service to be managed chkconfig, and make sure the service has a start entry at every runlevel | chkconfig --add |
chkconfig Options: Remove a service from chkconfig management and remove symbolic links to the service from /etc/rc0-6.d | chkconfig --del |
chkconfig Options: Specify the level to which a service should belong | chkconfig --level |
chkconfig Option Example: Activate the atd daemon for runlevel 1 | chkconfig --level 1 atd |
chkconfig Options: Starts, stops, or resets the named service for a specified runlevel | chkconfig --level on|off|reset |
chkconfig Options: Lists the services and their runlevels | chkconfig --list |
chkonfig Options for BSD: list services and their runlevels | chkonfig -l |
chkonfig Options for BSD: Specify the level to which a service should belong | chkonfig -s |
An EVENT_BASED replacement for the /sbin/init daemon | upstart |
upstart uses the DEFAULT_RUNLEVEL environment variable to set the default runlevel in: | /etc/init/rc-sysinit.conf |
A series of instructions that init reads which typically include a program and the name of an event | job |
A job that performs its work and returns to a waiting state when it is done | task |
A job that does not normally terminate itself | service |
A replacement for both the /sbin/init daemon and Upstart - allows services to be started in parallel at system startup | systemd |
systemd is compatible with: | SysV and Linux Standard Base (LSB) init runlevel scripts |
For starting services, systemd uses: | Socket and D-Bus activation and services can be started on demand |
systemd tracks processes using Liux kernel groups known as: | cgroups |
systemd supports: | Snapshotting and restoring of the system state |
Used to manage services and runlevels - Combines the functionality of both service and chkconfig | systemctl |
Systemd: To switch to runlevel 3 | systemctl isolate runlevel3.target.
systemctl isolate multi-user.target |
Systemd: To switch to runlevel 5 | systemctl isolate graphical.target
systemctl isolate runlevel5.target |
A new concept introduced by systemd - similar to runlevels used by init but differ in that they are named and numbered. They are started by the systemctl command | targets |
systemd targets: A symlink to another target file in the /lib/systemd/system directory | default.target |
systemd targets: Starts an emergency shell on the console | emergency.target |
systemd targets: Starts a system with network support in multi-user mode and with a display manager | graphical.target |
systemd targets: Shuts the system down | halt.target |
systemd targets: Starts a system with all services needed for sending and receiving email | mail-transfer-agent.target |
systemd targets: Starts a system in multi-user mode with network services | multi-user.target |
systemd targets: Reboots the system | reboot.target |
systemd targets: Starts a system in single-user mode without network services | rescue.target |
Are used to track processes (instead of process IDs) for systemd | Kernel Control Groups (cgroups) |
Is a collection of processes that are bound together by common criteria | cgroups |
They are organized into parent-child relationships (hierarchical) | cgroups |
Sending signals to parent processes, such as kill signals, also kills the child process in the: | cgroup |
Init Runlevel: 0 - System shutdown | systemd target: - runlevel0.target - halt.target -poweroff.target |
Init Runlevel: 1, S - Single user mode | systemd target: runlevel1.target - rescue.target |
Init Runlevel: 2 - Local multi-user without remote network | systemd target: runlevel2.target - multi-user.target |
Init Runlevel: 3 - Full multi-user with network | systemd target: runlevel3.target - multi-user.target |
Init Runlevel: 4 - Unused/User defined | systemd target: runlevel4.target |
Init Runlevel: 5 - Full multi-user with network and display manager | systemd target: runlevel5.target - graphical.target |
Init Runlevel: 6 - System reboot | systemd target: runlevel6.target - reboot.target |
To see if the the cups service is enables (systemd) | systemctl is-enabled cups.service |
Disable the cups service with (systemd) | systemctl disable cups.service |
To see the status of the cups service (systemd) | systemctl status cups.service |