linux_wiki:init_systems

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux_wiki:init_systems [2015/03/10 22:04]
billdozor created
linux_wiki:init_systems [2019/05/25 23:50] (current)
Line 6: Line 6:
  
 **Checklist** **Checklist**
-  * Distro: Varies, depending upon init system.+  * Distro(s): Varies, depending upon init system. 
 + 
 +---- 
 + 
 +===== All Inits ===== 
 + 
 +This section will compare three init systems; sysv, upstart, and systemd. 
 + 
 +==== Command Table ==== 
 + 
 +  * The service name "foo" will be used in all examples. 
 +  * systemctl assumes ".service" appended to unit name if left off 
 + 
 +^ Command ^ Sysv ^ Upstart ^ Systemd ^ 
 +| Status of Service | service foo status | initctl status foo | systemctl status foo | 
 +| Start Service | service foo start | initctl start foo | systemctl start foo | 
 +| Stop Service | service foo stop | initctl stop foo | systemctl stop foo | 
 +| Restart Service | service foo restart | initctl restart foo | systemctl restart foo | 
 +| Reload config file | service foo reload | initctl reload foo | systemctl reload foo | 
 +| List services | ls /etc/init.d/ | initctl list | systemctl (or)\\ systemctl list-unit-files (or)\\ systemctl list-unit-files --type=service | 
 +| Enable Service At Boot | chkconfig foo on | Edit /etc/init/<jobname>.conf "start on" field | systemctl enable foo | 
 +| Disable Service At Boot | chkconfig foo off | Edit /etc/init/<jobname>.conf "start on" field | systemctl disable foo | 
 +| List services and enabled run levels | chkconfig --list | initctl show-config | systemctl list-unit-files --type=service (or)\\ ls /etc/systemd/system/*.wants/
 + 
 +---- 
 + 
 +==== All Inits Run Levels ==== 
 + 
 +^ Description ^ Sysv ^ Upstart ^ Systemd ^ 
 +| Halt system | 0 | runlevel [0] | poweroff.target | 
 +| Single user mode | 1,s,single | runlevel [1] | rescue.target | 
 +| User defined. Same as 3 by default. | 2,4 | runlevel [24] | multi-user.target | 
 +| Multi-user, non-graphical | 3 | runlevel [3] | multi-user.target | 
 +| Multi-user, graphical | 5 | runlevel [5] | graphical.target | 
 +| Reboot | 6 | runlevel [6] | reboot.target | 
 +| Emergency shell | emergency | ? | emergency.target | 
 + 
 +  * Note: Upstart has many different "events" besides runlevels that can trigger jobs to start, such as "start on file-system" or "start on startup"
  
 ---- ----
  
 ===== SysV Init (init) ===== ===== SysV Init (init) =====
 +
 +Sysv init details not contained in All Inits section.
  
 __Distributions__: RHEL/CentOS <= 6 (RHEL 6 uses an init/upstart combination), Debian <= 7 __Distributions__: RHEL/CentOS <= 6 (RHEL 6 uses an init/upstart combination), Debian <= 7
- 
-==== Init run levels ==== 
-  * 0 : shutdown 
-  * 1 and S : single user mode 
-  * 2 - 5 : include networking support (GUI login can start at one of these, distro depending) 
-  * 6 : reboot level 
  
 ==== Defualt run level ==== ==== Defualt run level ====
Line 29: Line 62:
  
 ==== Master Copy of Startup Scripts ==== ==== Master Copy of Startup Scripts ====
-/etc/init.d/+/etc/rc.d/init.d/
  
 ==== rc#.d directories ==== ==== rc#.d directories ====
-The rc#.d directories contain symbolic links to the scripts in /etc/init.d.+The rc#.d directories contain symbolic links to the scripts in /etc/rc.d/init.d.
  
 # = the run level, ie rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d # = the run level, ie rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d
Line 47: Line 80:
 ==== Manage Services ==== ==== Manage Services ====
  
-  * chkconfig: Red Hat based systems +  * service command: RedHat and Debian (service status/stop/start/restart) 
-  * update-rc.d: Debian/Ubuntu +  * chkconfig: Red Hat based systems (enable/disable services) 
- +  * update-rc.d: Debian/Ubuntu (enable/disable services)
-List all services and the run levels they will start on: +
-<code bash> +
-chkconfig --list +
-</code> +
- +
-List a single service: +
-<code bash> +
-chkconfig --list httpd +
-</code> +
- +
-Set a service to start on boot +
-<code bash> +
-chkconfig httpd on +
-</code> +
- +
-==== Control Services ==== +
-Show service status +
-<code bash> +
-service httpd status +
-or +
-/etc/init.d/httpd status +
-</code> +
- +
-Stop/start/restart a service +
-<code bash> +
-service httpd stop +
-service httpd start +
-service httpd restart +
-</code>+
  
 ---- ----
  
 ===== Upstart ===== ===== Upstart =====
 +
 +Upstart details not contained in All Inits section.
  
 __Distributions__: Ubuntu 9.10 - Current (migrating to systemd), RHEL/CentOS 6 (some scripts) __Distributions__: Ubuntu 9.10 - Current (migrating to systemd), RHEL/CentOS 6 (some scripts)
  
 Upstart uses event driven jobs, instead of run levels to executes scripts. Upstart uses event driven jobs, instead of run levels to executes scripts.
-It does have events for rc0-6 to maintain comptability with init.+It does have events for rc0-6 to maintain compatibility with init.
  
-==== Job Definition Files ==== +  * Job Definition Files Location: /etc/init
- +  * Job control: initctl
-  * Location: /etc/event.d+
- +
-==== Control Jobs ==== +
- +
-List all known jobs +
-<code bash> +
-initctl list +
-</code> +
- +
-Show status of a job +
-<code bash> +
-initctl status httpd +
-</code> +
- +
-Stop/start/restart a job +
-<code bash> +
-initctl stop httpd +
-initctl start httpd +
-initctl restart httpd +
-</code>+
  
 ---- ----
  
 ===== Systemd ===== ===== Systemd =====
 +
 +Systemd details not contained in All Inits section.
  
 __Distributions__: RHEL/CentOS 7, Debian 8, Ubuntu 15.4? __Distributions__: RHEL/CentOS 7, Debian 8, Ubuntu 15.4?
Line 120: Line 108:
 ==== Location of Unit Scripts ==== ==== Location of Unit Scripts ====
  
-All of systemd unit scripts are located here (and sub folders): +  * All of systemd unit scripts are located here (and sub folders): /usr/lib/systemd/ 
-<code bash> +  Systemd uses this directory of symlinks to run those scripts: /etc/systemd/system/ 
-/usr/lib/systemd/ +  Other systemd configuration: /etc/systemd/ 
-</code> +  * Unit control: systemctl
- +
-Systemd uses this directory of symlinks to run those scripts: +
-<code bash> +
-/etc/systemd/system/ +
-</code> +
- +
-Other systemd configuration: +
-<code bash> +
-/etc/systemd/ +
-</code> +
- +
-==== Control Units ==== +
- +
-List all loaded units +
-<code bash> +
-systemctl list-units +
-or +
-systemctl +
-</code> +
- +
-List all loaded but inactive too +
-<code bash> +
-systemctl --all +
-</code> +
- +
-List all installed units +
-<code bash> +
-systemctl list-unit-files +
-</code> +
- +
-Show status of a unit +
-<code bash> +
-systemctl status NetworkManager.service +
-or +
-systemctl status NetworkManager +
-</code> +
- +
-Stop/start/restart a unit +
-<code bash> +
-systemctl stop NetworkManager +
-systemctl start NetworkManager +
-systemctl restart NetworkManager +
-</code>+
  
 ==== Laptop: Disable Suspend ==== ==== Laptop: Disable Suspend ====
  • linux_wiki/init_systems.1426039460.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)