<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:foaf="https://xmlns.com/foaf/0.1/" xmlns:og="https://ogp.me/ns#" xmlns:rdfs="https://www.w3.org/2000/01/rdf-schema#" xmlns:schema="https://schema.org/" xmlns:sioc="https://rdfs.org/sioc/ns#" xmlns:sioct="https://rdfs.org/sioc/types#" xmlns:skos="https://www.w3.org/2004/02/skos/core#" xmlns:xsd="https://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/tag/systemd">
  <channel>
    <title>systemd</title>
    <link>https://www.linuxjournal.com/tag/systemd</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Linux Filesystem Events with inotify</title>
  <link>https://www.linuxjournal.com/content/linux-filesystem-events-inotify</link>
  <description>  &lt;div data-history-node-id="1339561" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/security-1202344_640_8.jpg" width="600" height="338" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/charles-fisher" lang="" about="https://www.linuxjournal.com/users/charles-fisher" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Charles Fisher&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
&lt;cite&gt;Triggering scripts with incron and systemd.&lt;/cite&gt;
&lt;/p&gt;

&lt;p&gt;
It is, at times, important to know when things change in the Linux OS. The uses to
which systems are placed often include high-priority data that must be processed
as soon as it is seen. The conventional method of finding and processing new file
data is to poll for it, usually with cron. This is inefficient, and it can
tax performance unreasonably if too many polling events are forked too often.
&lt;/p&gt;

&lt;p&gt;
Linux has an efficient method for alerting user-space processes to changes
impacting files of interest. The inotify Linux system calls were first discussed
here in &lt;em&gt;Linux Journal&lt;/em&gt; in a &lt;a href="https://www.linuxjournal.com/article/8478"&gt;2005 article by Robert Love&lt;/a&gt;
who primarily addressed
the behavior of the new features from the perspective of C.
&lt;/p&gt;

&lt;p&gt;
However, there also are stable shell-level utilities and new classes of
monitoring dæmons
for registering filesystem watches and reporting events. Linux installations
using systemd also can access basic inotify functionality with path units. The
inotify interface does have limitations—it can't monitor remote,
network-mounted filesystems (that is, NFS); it does not report the userid involved in
the event; it does not work with /proc or other pseudo-filesystems; and mmap()
operations do not trigger it, among other concerns. Even with these limitations,
it is a tremendously useful feature.
&lt;/p&gt;

&lt;p&gt;
This article completes the work begun by
Love and gives everyone who can write a Bourne shell script or set a crontab the
ability to react to filesystem changes.
&lt;/p&gt;

&lt;h3&gt;
The inotifywait Utility&lt;/h3&gt;

&lt;p&gt;
Working under Oracle Linux 7 (or similar versions of Red Hat/CentOS/Scientific
Linux), the inotify shell tools are not installed by default, but you can load
them with yum:

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/linux-filesystem-events-inotify" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Mon, 08 Jan 2018 15:38:34 +0000</pubDate>
    <dc:creator>Charles Fisher</dc:creator>
    <guid isPermaLink="false">1339561 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Initializing and Managing Services in Linux: Past, Present and Future</title>
  <link>https://www.linuxjournal.com/content/initializing-and-managing-services-linux-past-present-and-future</link>
  <description>  &lt;div data-history-node-id="1338725" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/200px-Tux-linux_logo.svg__0_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/jonas-gorauskas" lang="" about="https://www.linuxjournal.com/users/jonas-gorauskas" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Jonas Gorauskas&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
One of the most crucial pieces of any UNIX-like operating system is the
init dæmon process. In Linux, this process is started by the kernel,
and it's the first userspace process to spawn and the last one to die
during shutdown.
&lt;/p&gt;

&lt;p&gt;
During the history of UNIX and Linux, many init systems have
gained popularity and then faded away. In this article, I focus on the
history of the init system as it relates to Linux, and I talk about the
role of init in a modern Linux system. I also relate some of the history
of the System V Init (SysV) scheme, which was the de facto standard for many
Linux distributions for a long time. Then I cover a couple more
modern approaches to system initialization, such as Upstart and systemd.
Finally, I
pay some attention to how things work in systemd, as this seems to be
the popular choice at the moment for several of the largest distributions.
&lt;/p&gt;


&lt;h3&gt;
The Role of Init&lt;/h3&gt;

&lt;p&gt;
Init is short for initializer, and it's both a startup manager and a
session manager for Linux and other UNIXes. It's a startup manager,
because it plays a crucial role in the startup of Linux. It's the
process that creates or initializes userspace and, ultimately, all
userspace processes. It also may be considered a session manager,
because it takes care of many aspects of userspace and its processes
once the system is up and running.
&lt;/p&gt;

&lt;p&gt;
The call to start this process is, in fact, hard-coded in the Linux
kernel. Download the latest kernel sources and look for a function
called kernel_init in the file init/main.c. Among the files that the
Linux kernel will try to execute is /sbin/init. If Linux cannot find
one of these processes, it throws a kernel panic and halts.
&lt;/p&gt;

&lt;p&gt;
The kernel gives the init process an ID of 1 or PID 1. All other
userspace processes are forked from init, and therefore, PID 1 claims
ancestral rights to all other userspace processes. PID 1 also
automatically will become the direct parent process of any userspace process
that is orphaned.
&lt;/p&gt;


&lt;h3&gt;
A Little Bit of History&lt;/h3&gt;

&lt;p&gt;
Now that I have set the stage for the article and given you a very basic
understanding of what init is and does, I'd like to digress into
a little bit of UNIX history.
&lt;/p&gt;

&lt;p&gt;
There has been a lot of diversity in the initialization schemes for
UNIX-like operating systems over time. Two of the most important init
schemes that had a historical impact on how different Linux distributions
do things are the rc scheme used in the 4.4 BSD and the SysV scheme
used in SunOS and Solaris.
&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/initializing-and-managing-services-linux-past-present-and-future" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Wed, 20 May 2015 18:17:58 +0000</pubDate>
    <dc:creator>Jonas Gorauskas</dc:creator>
    <guid isPermaLink="false">1338725 at https://www.linuxjournal.com</guid>
    </item>
<item>
  <title>Infinite BusyBox with systemd</title>
  <link>https://www.linuxjournal.com/content/infinite-busybox-systemd</link>
  <description>  &lt;div data-history-node-id="1338711" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/Systemd-on-fedora_0.jpg" width="120" height="134" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/charles-fisher" lang="" about="https://www.linuxjournal.com/users/charles-fisher" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Charles Fisher&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;Lightweight virtual containers with PID 1.&lt;/p&gt;

&lt;p&gt;
In this article, I demonstrate a method to build one Linux system
within another using the latest utilities within the systemd suite of
management tools. The guest OS container design focuses upon BusyBox and
Dropbear for the userspace system utilities, but I also work through
methods for running more general application software so the containers are
actually useful.
&lt;/p&gt;

&lt;p&gt;
This tutorial was developed on Oracle Linux 7, and it likely will run
unchanged on its common brethren (Red Hat, CentOS, Scientific Linux), and
from here forward, I refer to this platform simply as V7. Slight
changes may be necessary on other systemd platforms (such as SUSE, Debian
or Ubuntu).
Oracle's V7 runs only on the x86_64 platform, so that's this article's
primary focus.
&lt;/p&gt;

&lt;h3&gt;
Required Utilities&lt;/h3&gt;

&lt;p&gt;
Red Hat saw fit to remove the long-included BusyBox binary from its V7
distribution, but this easily is remedied by downloading the latest binary
directly from the project's Web site. Since the /home filesystem gets a
large amount of space by default when installing V7, let's put it there
for now. Run the commands below as root until indicated otherwise:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
cd /home
wget https://busybox.net/downloads/binaries/latest/busybox-x86_64
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
You also can get a binary copy of the Dropbear SSH server and client from
this location:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
wget https://landley.net/aboriginal/downloads/
↪binaries/extras/dropbearmulti-x86_64
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
For this article, I used the following versions:
&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;
&lt;p&gt;
BusyBox v1.21.1.
&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;
Dropbear SSH multi-purpose v2014.63.
&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
These are static binaries that do not link against shared objects—nothing
else is required to run them, and they are ideal for building a new UNIX-ish
environment quickly.
&lt;/p&gt;

&lt;h3&gt;
Build a chroot&lt;/h3&gt;

&lt;p&gt;
The chroot system call and the associated shell utility allow an
arbitrary subdirectory somewhere on the system to be declared as the root
for all child processes. The commands below populate the "chroot
jail", then lock you in. Note that the call to chroot needs your change to
the SHELL environment variable below, as you don't have bash inside the jail
(and it's likely the default value of $SHELL):

&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/infinite-busybox-systemd" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Tue, 12 May 2015 12:58:35 +0000</pubDate>
    <dc:creator>Charles Fisher</dc:creator>
    <guid isPermaLink="false">1338711 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
