2

We use SUSE Linux Enterprise in our company.
We now have got our first SLES 12 machine (this is the first version in SLES that systemd is used).

I found a link where somebody says that "start", "stop" and "restart" is working, but "status" isn't covered anymore.

http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/3050

-- like ExecStatus?
No there isn't. For that the best thing is just to supply an independent tool, as there is little real need to integrate that in systemd itself.

So this guy seems to say that "systemctl status someservice" is not covered anymore, so you have to use another tool.

But then, if I enter systemctl status apache2, it works:

systemctl status apache2
apache2.service - The Apache Webserver
   Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled)
   Active: inactive (dead)

How did they achieve it to still have a working "systemclt status apache"?

1 Answer 1

4

systemd has a number of monitor types which handles basic stuff. A common one is "is the process started by systemd still running". This, along with configuration data, log lines, etc are the sort of information reported by systemctl

$ systemctl status httpd
* httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2016-06-03 09:27:28 EDT; 2 weeks 3 days ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 484 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 784 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           |- 532 /usr/sbin/httpd -DFOREGROUND
           |- 533 /usr/sbin/httpd -DFOREGROUND
           |- 534 /usr/sbin/httpd -DFOREGROUND
           |- 535 /usr/sbin/httpd -DFOREGROUND
           |- 536 /usr/sbin/httpd -DFOREGROUND
           |- 784 /usr/sbin/httpd -DFOREGROUND
           `-2677 /usr/sbin/httpd -DFOREGROUND

Jun 17 03:49:13 SERVER systemd[1]: Reloaded The Apache HTTP Server.
Jun 19 03:17:03 SERVER systemd[1]: Reloaded The Apache HTTP Server.
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Hint: Some lines were ellipsized, use -l to show in full.

What systemd doesn't handle is complicated stuff ("can my application talk to the database and provide good results"). With traditional init scripts the 'status' call could do almost anything. With systemd it's limited to the built-in tasks.

1
  • But somehow in your output the apache2 has told systemd its own Status (no. of requests, traffic, ...). And I cannot find anywhere how is this communicated between systemd and units...
    – Marki555
    Jul 21, 2021 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .