explicit use of /etc/rc.d vs service
Benjamin Kaduk
kaduk at MIT.EDU
Fri Jan 25 17:38:50 UTC 2013
On Thu, 24 Jan 2013, Eitan Adler wrote:
> On 24 January 2013 10:36, Warren Block <wblock at wonkity.com> wrote:
>> On Wed, 23 Jan 2013, Eitan Adler wrote:
>>
>>> Would anyone object to a patch which converts uses of
>>> "/etc/rc.d/daemon start" to "service daemon start" and the like?
>>> I would like to see service(1) become the standard interface to using
>>> services.
>>
>>
>> Agreed. service(1) puts things in one place and abstracts them. Also, it's
>> less typing and easier to autocomplete.
>
> Patch follows, also attached.
>
> commit c1cdabe869a82aa9ab56a30fee78530fc38ac8e3
> Author: Eitan Adler <lists at eitanadler.com>
> Date: Thu Jan 24 12:26:10 2013 -0500
>
> Prefer the use of service(1) to explicit invocation of /etc/rc.d
> scripts: service(1) puts things in one place and abstracts them.
> Also, it's less
> typing and easier to autocomplete.
>
> While here modernize one script example by removing the ".sh" suffix.
>
> Discussed on: -doc
> Reviewed by: ???
> Approved by: ??? (mentor)
These '???'s would be less likely to leak into your actual commits if they
were only added once received...
>
> diff --git a/en_US.ISO8859-1/books/handbook/disks/chapter.xml
> b/en_US.ISO8859-1/books/handbook/disks/chapter.xml
> index 176c7b2..345fdc4 100644
> --- a/en_US.ISO8859-1/books/handbook/disks/chapter.xml
> +++ b/en_US.ISO8859-1/books/handbook/disks/chapter.xml
> @@ -3542,7 +3542,7 @@ sector_size = 2048
> <filename>/etc/gbde/ad4s1c.lock</filename>.
> <application>gbde</application> lock files must end in
> <quote>.lock</quote> in order to be correctly detected
> - by the <filename>/etc/rc.d/gbde</filename> start up
> + by the <filename>service gbde</filename> start up
This is not correct. It is the gbde start-up script which is relevant;
that script is located in /etc/rc.d/gbde. service(8) does not come into
play.
> script.</para>
>
> <caution>
> diff --git a/en_US.ISO8859-1/books/handbook/jails/chapter.xml
> b/en_US.ISO8859-1/books/handbook/jails/chapter.xml
> index 71cf55c..264d0c6 100644
> --- a/en_US.ISO8859-1/books/handbook/jails/chapter.xml
> +++ b/en_US.ISO8859-1/books/handbook/jails/chapter.xml
> @@ -370,12 +370,12 @@
> jail_<replaceable>www</replaceable>_devfs_ruleset="<replaceable>www_ruleset</rep
> </step>
> </procedure>
>
> - <para>The <filename>/etc/rc.d/jail</filename> script can be used to
> + <para>The <filename>service jail</filename> script can be used to
Likewise here.
> start or stop a jail by hand, if an entry for it exists in
> <filename>rc.conf</filename>:</para>
>
> - <screen>&prompt.root; <userinput>/etc/rc.d/jail start
> <replaceable>www</replaceable></userinput>
> -&prompt.root; <userinput>/etc/rc.d/jail stop
> <replaceable>www</replaceable></userinput></screen>
> + <screen>&prompt.root; <userinput>service jail start
> <replaceable>www</replaceable></userinput>
> +&prompt.root; <userinput>service jail stop
> <replaceable>www</replaceable></userinput></screen>
>
> <para>A clean way to shut down a &man.jail.8; is not available at
> the moment. This is because commands normally used to accomplish
> @@ -858,10 +858,10 @@ jail_www_devfs_enable="YES"</programlisting>
> <para>In this phase, the jails are built and prepared to
> run. First, mount the required file systems for each
> jail, and then start them using the
> - <filename>/etc/rc.d/jail</filename> script:</para>
> + <filename>service jail</filename> script:</para>
This might be better as "using the jail rc script" (as compared to the
previous cases quoted), but is still wrong as it appears here.
>
> <screen>&prompt.root; <userinput>mount -a</userinput>
> -&prompt.root; <userinput>/etc/rc.d/jail start</userinput></screen>
> +&prompt.root; <userinput>service jail start</userinput></screen>
> </step>
> </procedure>
>
> diff --git a/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml
> b/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml
> index b9c42c0..bd77283 100644
> --- a/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml
> +++ b/en_US.ISO8859-1/books/handbook/linuxemu/chapter.xml
> @@ -622,7 +622,7 @@ done</programlisting>
> <step><para>Start the license server.</para>
>
> <para>The following script, installed as
> - <filename>/usr/local/etc/rc.d/lmgrd.sh</filename> is a
> + <filename>/usr/local/rtc/rc.d/lmgrd</filename> is a
> convenient way to start up <command>lmgrd</command>:</para>
>
> <programlisting> ----- snip ------------
> @@ -799,7 +799,7 @@ FEATURE Maple maplelmg 2000.0831 permanent 1 XXXXXXXXXXXX \
>
> <step>
> <para>Create a startup file at
> - <filename>/usr/local/etc/rc.d/flexlm.sh</filename>. The
> + <filename>/usr/local/etc/rc.d/flexlm</filename>. The
The commit message only mentions one place where a .sh suffix was
stripped; there are two here.
> example below is a modified version of the distributed
> <filename>$MATLAB/etc/rc.lm.glnx86</filename>. The changes
> are file locations, and startup of the license manager
> @@ -828,7 +828,7 @@ exit 0</programlisting>
> <important>
> <para>The file must be made executable:</para>
>
> - <screen>&prompt.root; <userinput>chmod +x
> /usr/local/etc/rc.d/flexlm.sh</userinput></screen>
> + <screen>&prompt.root; <userinput>chmod +x
> /usr/local/etc/rc.d/flexlm</userinput></screen>
Oops, three.
>
> <para>You must also replace
> <replaceable>username</replaceable> above with the name
> @@ -840,7 +840,7 @@ exit 0</programlisting>
> <step>
> <para>Start the license manager with the command:</para>
>
> - <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/flexlm.sh
> start</userinput></screen>
> + <screen>&prompt.root; <userinput>service flexlm start</userinput></screen>
> </step>
> </procedure>
> </sect2>
> diff --git a/en_US.ISO8859-1/books/handbook/mac/chapter.xml
> b/en_US.ISO8859-1/books/handbook/mac/chapter.xml
> index adb4c4d..a0c4594 100644
> --- a/en_US.ISO8859-1/books/handbook/mac/chapter.xml
> +++ b/en_US.ISO8859-1/books/handbook/mac/chapter.xml
> @@ -1840,7 +1840,7 @@ default_labels socket ?biba</programlisting>
>
> <screen>&prompt.root; <userinput>cd /etc/mail && make
> stop && \
> setpmac biba/equal make start && setpmac biba/10\(10-10\)
> apachectl start && \
> -setpmac biba/10\(10-10\) /usr/local/etc/rc.d/nagios.sh
> forcestart</userinput></screen>
> +setpmac biba/10\(10-10\) service nagios.sh forcestart</userinput></screen>
Does 'service nagios.sh' even work?
>
> <para>Double check to ensure that everything is working
> properly. If not, check the log files or error messages. Use
> diff --git a/en_US.ISO8859-1/books/handbook/network-servers/chapter.xml
> b/en_US.ISO8859-1/books/handbook/network-servers/chapter.xml
> index c88c3c4..af24044 100644
> --- a/en_US.ISO8859-1/books/handbook/network-servers/chapter.xml
> +++ b/en_US.ISO8859-1/books/handbook/network-servers/chapter.xml
> @@ -173,7 +173,7 @@
> <application>inetd</application> starting at boot time.
> The command:</para>
>
> - <screen>&prompt.root; <userinput>/etc/rc.d/inetd
> rcvar</userinput></screen>
> + <screen>&prompt.root; <userinput>service inetd rcvar</userinput></screen>
Wow, that's an uncommon command to pass to service!
>
> <para>
> can be run to display the current effective setting.</para>
> @@ -4586,7 +4586,7 @@ $include Kexample.com.+005+nnnnn.ZSK.key ;
> ZSK</programlisting>
> installs an &man.rc.8; script to aid in starting, stopping,
> and restarting <application>Apache</application>, which can be
> found in the <filename
> - class="directory">/usr/local/etc/rc.d/</filename>
> + class="directory">service </filename>
Ahem.
> directory.</para>
>
> <para>To launch <application>Apache</application> at system
> @@ -4622,10 +4622,8 @@ $include Kexample.com.+005+nnnnn.ZSK.key ;
> ZSK</programlisting>
> <para>If <application>Apache</application> does not report
> configuration errors, the
> <application>Apache</application> <command>httpd</command>
> - can be started with the same &man.rc.8; and &man.service.8;
> - mechanisms:</para>
> + can be started with &man.service.8;:</para>
>
> - <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/apache22
> start</userinput></screen>
> <screen>&prompt.root; <userinput>service apache22
> start</userinput></screen>
I am less excited than you about removing mention of rc.d in this case
than you are, but not enough so so as to object to it.
>
> <para>The <command>httpd</command> service can be tested by
> diff --git a/en_US.ISO8859-1/books/handbook/security/chapter.xml
> b/en_US.ISO8859-1/books/handbook/security/chapter.xml
> index 718b71a..4cf46b6 100644
> --- a/en_US.ISO8859-1/books/handbook/security/chapter.xml
> +++ b/en_US.ISO8859-1/books/handbook/security/chapter.xml
> @@ -1484,9 +1484,9 @@ qpopper : ALL : allow</programlisting>
>
> <para>After adding this line, <application>inetd</application>
> will need to be restarted. This can be accomplished by use of
> - the &man.kill.1; command, or with the
> - <parameter>restart</parameter> parameter with
> - <filename>/etc/rc.d/inetd</filename>.</para>
> + &man.kill.1; or by &man.service.8;:</para>
> +
> + <screen>&prompt.root; <userinput>service inetd restart</userinput></screen>
I guess you're not in a kill-killing mood today, then. (Similar case to
the previous item.)
> </sect2>
>
> <sect2>
> @@ -1984,7 +1984,7 @@ kadmin><userinput> exit</userinput></screen>
> example we will enable the <command>telnet</command> service
> by putting a line like this into your
> <filename>/etc/inetd.conf</filename> and then restarting the
> - &man.inetd.8; service with <command>/etc/rc.d/inetd
> + &man.inetd.8; service with <command>service inetd
Hmm, maybe this block and the previous should use a more identical
wording.
-Ben
> restart</command>:</para>
>
> <programlisting>telnet stream tcp nowait root
> /usr/libexec/telnetd telnetd -a user</programlisting>
More information about the freebsd-doc
mailing list