Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:init_systems [2015/03/10 22:04] billdozor created |
linux_wiki:init_systems [2016/03/18 23:07] billdozor [Init Systems] |
||
---|---|---|---|
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 " | ||
+ | * systemctl assumes " | ||
+ | |||
+ | ^ 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 / | ||
+ | | Enable Service At Boot | chkconfig foo on | Edit / | ||
+ | | Disable Service At Boot | chkconfig foo off | Edit / | ||
+ | | List services and enabled run levels | chkconfig --list | initctl show-config | systemctl list-unit-files --type=service (or)\\ ls / | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== 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 " | ||
---- | ---- | ||
===== SysV Init (init) ===== | ===== SysV Init (init) ===== | ||
+ | |||
+ | Sysv init details not contained in All Inits section. | ||
__Distributions__: | __Distributions__: | ||
- | |||
- | ==== 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/rc.d/init.d/ |
==== rc#.d directories ==== | ==== rc#.d directories ==== | ||
- | The rc#.d directories contain symbolic links to the scripts in / | + | 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 | + | |
- | * update-rc.d: | + | |
- | + | * update-rc.d: | |
- | List all services | + | |
- | <code bash> | + | |
- | chkconfig --list | + | |
- | </ | + | |
- | + | ||
- | List a single service: | + | |
- | <code bash> | + | |
- | chkconfig --list httpd | + | |
- | </ | + | |
- | + | ||
- | Set a service to start on boot | + | |
- | <code bash> | + | |
- | chkconfig httpd on | + | |
- | </ | + | |
- | + | ||
- | ==== Control Services ==== | + | |
- | Show service status | + | |
- | <code bash> | + | |
- | service httpd status | + | |
- | or | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | Stop/ | + | |
- | <code bash> | + | |
- | service httpd stop | + | |
- | service httpd start | + | |
- | service httpd restart | + | |
- | </ | + | |
---- | ---- | ||
===== Upstart ===== | ===== Upstart ===== | ||
+ | |||
+ | Upstart details not contained in All Inits section. | ||
__Distributions__: | __Distributions__: | ||
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 | + | It does have events for rc0-6 to maintain |
- | ==== Job Definition Files ==== | + | * Job Definition Files Location: /etc/init/ |
- | + | * Job control: | |
- | * Location: /etc/event.d/ | + | |
- | + | ||
- | ==== Control Jobs ==== | + | |
- | + | ||
- | List all known jobs | + | |
- | <code bash> | + | |
- | initctl | + | |
- | </ | + | |
- | + | ||
- | Show status of a job | + | |
- | <code bash> | + | |
- | initctl status httpd | + | |
- | </ | + | |
- | + | ||
- | Stop/ | + | |
- | <code bash> | + | |
- | initctl stop httpd | + | |
- | initctl start httpd | + | |
- | initctl restart httpd | + | |
- | </ | + | |
---- | ---- | ||
===== Systemd ===== | ===== Systemd ===== | ||
+ | |||
+ | Systemd details not contained in All Inits section. | ||
__Distributions__: | __Distributions__: | ||
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): / |
- | <code bash> | + | |
- | / | + | |
- | </ | + | * Unit control: |
- | + | ||
- | Systemd uses this directory of symlinks to run those scripts: | + | |
- | <code bash> | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | Other systemd configuration: | + | |
- | <code bash> | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | ==== Control Units ==== | + | |
- | + | ||
- | List all loaded units | + | |
- | <code bash> | + | |
- | systemctl | + | |
- | or | + | |
- | systemctl | + | |
- | </ | + | |
- | + | ||
- | List all loaded but inactive too | + | |
- | <code bash> | + | |
- | systemctl --all | + | |
- | </ | + | |
- | + | ||
- | List all installed units | + | |
- | <code bash> | + | |
- | systemctl list-unit-files | + | |
- | </ | + | |
- | + | ||
- | Show status of a unit | + | |
- | <code bash> | + | |
- | systemctl status NetworkManager.service | + | |
- | or | + | |
- | systemctl status NetworkManager | + | |
- | </ | + | |
- | + | ||
- | Stop/ | + | |
- | <code bash> | + | |
- | systemctl stop NetworkManager | + | |
- | systemctl start NetworkManager | + | |
- | systemctl restart NetworkManager | + | |
- | </ | + | |
==== Laptop: Disable Suspend ==== | ==== Laptop: Disable Suspend ==== |