Open main menu

CDOT Wiki β

Changes

Init vs systemd

961 bytes added, 18:15, 30 January 2016
no edit summary
:In "Simpler TermsLanguage":
:'''systemd''' is a more efficient method of controlling processes. It has the flexibility to start services in parallel, and have them communicate with each other, even if they are restarted (respawned). This is particularly useful for system administrators to temporarily service or update services without affecting the other dependent services.
:Traditionally, the '''init program would run default processes''' that were defined in "shell scripts" contained in appropriate '''run-level''' directory. The run level is a defined state that the Unix/Linux system is currently in (for example, graphical-mode, text-based mode with networking, text-based mode without networking, etc).
|
[[Image:pstree.png|thumb|300px200px| '''pstree''' command displaying relationship between '''init''' and other services (processes).]]
|
[[Image:rc_directory.png|thumb|300px200px| Traditional method of managing services via '''run-levels'''. Each run-level directory contains scripts to sequentially launch services.]]
|}
=== Why Switch to systemd? ===
:Why switch to systemd when the concept of init and run levels seemed to work for 40 years?!? If it isn't broke, why try to fix it?!?
 
:Yes, the concept is very easy to understand. '''On the other hand, with modern operating systems, there is pressure to "evolve" into more efficent running operating systems'''. For example, in many ways both Apple creators and Unix/Linux creators have influenced each other to build better operating systems over the past decade. The Apple Mac OSX operating system uses a variation of the Unix kernel. On the other hand, Unix/Linux developpers have noticed Apple's method of running services in parallel as opposed to in sequence.
 
:Here is an example comparing init vs systemd:
:(Reference: [http://www.youtube.com/watch?v=TyMLi8QF6sw (beyond init: systemd)] )
 
:Services are organized in terms of '''units''' which consist of a '''name''' and a '''type''' which correspond to a configuration file.
:'''There are seven different types of units:'''
<div style="margin-left:20px30px">
{|cellpadding="8" width="50%" border="1" cellspacing="0"
:'''NOTE: For this tutorial resource, we only focus on the <u>service</u> unit.'''
:'''Below are examples of systemctl commands:''' <div style="margin-left:20px30px">{|cellpadding="8" width="5070%" border="1" cellspacing="0"|-|Listing Running Services|<span style="font-family:courier,monospace">'''systemctl list-units'''</span>|-|Display Status of all Services<br>(pipe to grep for just one service)|<span style="font-family:courier,monospace">'''systemctl list-units --all'''</span>|-|Confirm Status of Running Service|<span style="font-family:courier,monospace">'''systemctl status name.service'''</span>
|-
|Stop Service|<span style="font-family:courier,monospace">'''systemctl stop service-name.service'''</span>
|-
|Start Service|<span style="font-family:courier,monospace">'''systemctl start service-name.service'''</span>
|-
|Restart Service
|<span style="font-family:courier,monospace">'''systemctl restart service-name.service'''</span>
|-
|Display Service Status
|<span style="font-family:courier,monospace">'''systemctl status service-name.service'''</span>
|-
|Enable Service
|<span style="font-family:courier,monospace">'''systemctl enable service-name.service'''</span>
|-
|Disable Service
|<span style="font-family:courier,monospace">'''systemctl disable name.service'''</span>|-|Listing Running Services|<span style="font-family:courier,monospace">'''systemctl --list-units'''</span>|-|Display Status of all Services|<span style="font-family:courier,monospace">'''systemctl --list-units --allname'''</span> 
|}
{{Admon/note|Graphical Version|The '''systemadm''' command provides a graphical tool to manage services, but is still in the development stage and should not be used.|}}
=== Changing the Runlevel ===
 
According to WIKIPedia ([http://en.wikipedia.org/wiki/Runlevel http://en.wikipedia.org/wiki/Runlevel])"
 
:''"Runlevel" defines the state of the machine after boot. Different runlevels are typically assigned to:''
 
::* ''single-user mode''
::* ''multi-user mode without network services started''
::* ''multi-user mode with network services started''
::* ''system shutdown''
::* system reboot
 
:''The exact setup of these configurations will vary from OS to OS, and from one Linux distribution to another.''
 
 
'''Refer to the following link to change the runlevel of your system using systemctl:'''
 
::[http://fedoraproject.org/wiki/Systemd#How_do_I_change_the_runlevel.3F http://fedoraproject.org/wiki/Systemd#How_do_I_change_the_runlevel.3F]
= Additional Resources =
:* YouTube Video (beyond init: systemd): [http://www.youtube.com/watch?v=TyMLi8QF6sw (beyond init: systemd)]
13,420
edits