Differences
This shows you the differences between two versions of the page.
linux_wiki:init_systems [2015/03/10 22:04] billdozor created |
linux_wiki:init_systems [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Init Systems ====== | ||
- | **General Information** | ||
- | |||
- | Down and dirty quick info about three different init systems that Linux uses; SysV init, upstart, and systemd. | ||
- | |||
- | **Checklist** | ||
- | * Distro: Varies, depending upon init system. | ||
- | |||
- | ---- | ||
- | |||
- | ===== SysV Init (init) ===== | ||
- | |||
- | __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 ==== | ||
- | * Set in file: / | ||
- | |||
- | Example with run level 5 as default: | ||
- | <code bash> | ||
- | id: | ||
- | </ | ||
- | |||
- | ==== Master Copy of Startup Scripts ==== | ||
- | / | ||
- | |||
- | ==== rc#.d directories ==== | ||
- | The rc#.d directories contain symbolic links to the scripts in / | ||
- | |||
- | # = the run level, ie rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d | ||
- | |||
- | __Locations__ | ||
- | * / | ||
- | * /etc/rc#.d | ||
- | |||
- | __Script Names__ | ||
- | * Scripts are named for if they are going to Start(S) or Kill(K) the script, a sequence number, and then the name of the script. | ||
- | * / | ||
- | * / | ||
- | |||
- | ==== Manage Services ==== | ||
- | |||
- | * chkconfig: Red Hat based systems | ||
- | * update-rc.d: | ||
- | |||
- | List all services and the run levels they will start on: | ||
- | <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 ===== | ||
- | |||
- | __Distributions__: | ||
- | |||
- | Upstart uses event driven jobs, instead of run levels to executes scripts. | ||
- | It does have events for rc0-6 to maintain comptability with init. | ||
- | |||
- | ==== Job Definition Files ==== | ||
- | |||
- | * Location: / | ||
- | |||
- | ==== Control Jobs ==== | ||
- | |||
- | List all known jobs | ||
- | <code bash> | ||
- | initctl list | ||
- | </ | ||
- | |||
- | Show status of a job | ||
- | <code bash> | ||
- | initctl status httpd | ||
- | </ | ||
- | |||
- | Stop/ | ||
- | <code bash> | ||
- | initctl stop httpd | ||
- | initctl start httpd | ||
- | initctl restart httpd | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Systemd ===== | ||
- | |||
- | __Distributions__: | ||
- | |||
- | ==== Location of Unit Scripts ==== | ||
- | |||
- | All of systemd unit scripts are located here (and sub folders): | ||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | |||
- | 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 list-units | ||
- | 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 ==== | ||
- | |||
- | On systemd based systems, the laptop suspend on lid closed can be disabled by changing the logind config. | ||
- | |||
- | 1) Edit / | ||
- | |||
- | 2) Uncomment " | ||
- | <code bash> | ||
- | HandleLidSwitch=ignore | ||
- | </ |