Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #257207

Re: Commands service and systemctl.

From Max Nikulin <manikulin@gmail.com>
Newsgroups linux.debian.user
Subject Re: Commands service and systemctl.
Date 2023-04-15 12:50 +0200
Message-ID <GkLDI-2aY5-3@gated-at.bofh.it> (permalink)
References <Gktx7-2038-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 14/04/2023 22:05, peter wrote:
> 
> https://en.wikipedia.org/wiki/Systemd has many occurrences of
> "service", none referring to the service command.

See systemd.unit(5). Besides services, systemd has sockets, timers and
other unit types.

> For several somethings, the result of command,
> service something COMMAND
> approximates the result of
> systemctl COMMAND something.service
> although systemctl might be more powerful.

Systemd may generate service units for scripts in /etc/init.d that do
not have their .service files. When systemd is running than the service
command should delegate operation to systemd that tracks states of
system services. So systemctl is native and more powerful in such case.

When SysV init is used than systemctl is not available. There are
even more subtle cases:

https://www.debian.org/doc/manuals/debian-handbook/unix-services.en.html
The Debian Administrator's Handbook
Chapter 9. Unix Services
9.1.2. The System V init system
> DEBIAN POLICY Restarting services
> 
> The maintainer scripts for Debian packages will sometimes restart
> certain services to ensure their availability or get them to take
> certain options into account. The command that controls a service —
> service service operation — doesn't take runlevel into consideration,
> assumes (wrongly) that the service is currently being used, and may thus
> initiate incorrect operations (starting a service that was deliberately
> stopped, or stopping a service that is already stopped, etc.). Debian
> therefore introduced the invoke-rc.d program: this program must be used
> by maintainer scripts to run services initialization scripts and it will
> only execute the necessary commands. Note that, contrary to common
> usage, the .d suffix is used here in a program name, and not in a
> directory. 

A specific init script might support operation that systemd is not aware 
of. I do think that you are fighting with portability issues, so use 
tool native to running init system.

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Commands service and systemctl. peter@easthope.ca - 2023-04-14 17:30 +0200
  Re: Commands service and systemctl. David Wright <deblis@lionunicorn.co.uk> - 2023-04-14 18:20 +0200
    Re: Commands service and systemctl. <tomas@tuxteam.de> - 2023-04-14 18:30 +0200
      Re: Commands service and systemctl. Brian <ad44@cityscape.co.uk> - 2023-04-14 20:50 +0200
        Re: Commands service and systemctl. <tomas@tuxteam.de> - 2023-04-14 21:00 +0200
          Re: Commands service and systemctl. Brian <ad44@cityscape.co.uk> - 2023-04-14 21:20 +0200
      Re: Commands service and systemctl. davidson <davidson@freevolt.org> - 2023-04-14 21:50 +0200
    Re: Commands service and systemctl. davidson <davidson@freevolt.org> - 2023-04-14 20:00 +0200
  Re: Commands service and systemctl. Max Nikulin <manikulin@gmail.com> - 2023-04-15 12:50 +0200
  Re: Commands service and systemctl. Anssi Saari <as@sci.fi> - 2023-04-15 13:30 +0200

csiph-web