<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan&#39;s Tech Blog</title>
    <link>https://blog.bekenev.net/tags/systemd.html</link>
    <description>Software development related stuff</description>
    <language>en-us</language>
    <lastBuildDate>Fri, 22 Apr 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bekenev.net/tags/systemd/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Use systemctl instead of service command</title>
      <link>https://blog.bekenev.net/2022/04/22/use-systemctl.html</link>
      <pubDate>Fri, 22 Apr 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2022/04/22/use-systemctl.html</guid>
      <description>&lt;h2 id=&#34;tldr&#34;&gt;TLDR;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;service&lt;/code&gt; is less functional wrapper around &lt;code&gt;systemctl&lt;/code&gt; command on systemd based distros.&lt;/p&gt;&#xA;&lt;h2 id=&#34;details&#34;&gt;Details&lt;/h2&gt;&#xA;&lt;p&gt;I&amp;rsquo;m a long time Linux user and got a habit to start/stop things using &lt;code&gt;service&lt;/code&gt; command.&lt;/p&gt;&#xA;&lt;p&gt;I never really thought about what exactly it does. I mean, I know I can start Apache or something else with it and it&amp;rsquo;s something related to init system of my distro.&#xA;Usually when you install Apache or PHP-FPM those things become recognizable by &lt;code&gt;service&lt;/code&gt; command and you can call &lt;code&gt;service program start&lt;/code&gt; when you want to start a service.&lt;/p&gt;&#xA;&lt;p&gt;I never really needed to write my own init scripts so I successfully skipped any knowledge related to init systems of various distros I used.&lt;/p&gt;&#xA;&lt;p&gt;Today I was reading &lt;a href=&#34;https://docs.fedoraproject.org/en-US/docs/&#34;&gt;Fedora Manual for Administrators&lt;/a&gt; and there are lot of stuff written about systemd and its insisted to use &lt;code&gt;systemctl&lt;/code&gt; command. Why is that if &lt;code&gt;service&lt;/code&gt; works too.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s close this question.&lt;/p&gt;&#xA;&lt;p&gt;Turned out &lt;code&gt;systemctl&lt;/code&gt; is part of &lt;code&gt;systemd&lt;/code&gt; package/program/init-system. And this is the tool to use when you want to interact with &lt;code&gt;systemd&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;service&lt;/code&gt; on the other hand is a script that allows you to start/stop other scripts defined in &lt;code&gt;/etc/init.d&lt;/code&gt; folder which was used by other init-systems in the past.&lt;/p&gt;&#xA;&lt;p&gt;Most systemd-based distros provide &lt;code&gt;service&lt;/code&gt; command for backward compatibility.&#xA;At first this command is going to look into &lt;code&gt;/etc/init.d&lt;/code&gt; folder and if no service found there then it will try to use &lt;code&gt;systemctl&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;service&lt;/code&gt; command doesn&amp;rsquo;t support all possible arguments supported by &lt;code&gt;systemctl&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So if you consciously decided to use systemd then you definitely should use &lt;code&gt;systemctl&lt;/code&gt; because it is the command that allows you to interact with &lt;code&gt;systemd&lt;/code&gt; services.&#xA;&lt;code&gt;service&lt;/code&gt; command behaves like proxy to &lt;code&gt;systemctl&lt;/code&gt;. Of course it behaves like proxy only if you don&amp;rsquo;t use &lt;code&gt;/etc/init.d&lt;/code&gt; for your daemons which you probably shouldn&amp;rsquo;t do on systemd based system.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
