[ megoldva ] systemctl láma

Fórumok

Hogyan lehetséges, hogy a "systemctl start apache" paranccsal el tudom indítani az apache webszerveremet, de a "systemctl --type=service" listában mégsem szerepel az apache?

Hozzászólások

systemctl --type=service |grep httpd
httpd.service                      loaded active running The Apache HTTP Server

Milyen rendszer ez? 
 

Debian 10. A systemctl --type=service --state=running kimenete:

UNIT                      LOAD   ACTIVE SUB     DESCRIPTION                                                      
cron.service              loaded active running Regular background program processing daemon                     
dbus.service              loaded active running D-Bus System Message Bus                                         
exim4.service             loaded active running LSB: exim Mail Transport Agent                                   
getty@tty1.service        loaded active running Getty on tty1                                                    
icinga.service            loaded active running LSB: icinga host/service/network monitoring and management system
mariadb.service           loaded active running MariaDB 10.1.47 database server                                  
pdns.service              loaded active running PowerDNS Authoritative Server                                    
rpcbind.service           loaded active running RPC bind portmap service                                         
rsyslog.service           loaded active running System Logging Service                                           
ssh.service               loaded active running OpenBSD Secure Shell server                                      
systemd-journald.service  loaded active running Journal Service                                                  
systemd-timesyncd.service loaded active running Network Time Synchronization                                     
systemd-udevd.service     loaded active running udev Kernel Device Manager                                       

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

13 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Pedig a webszerver fut közben, rendben szolgálja ki a kérelmeket.

systemctl --type=service --state=running |grep httpd
httpd.service              loaded active running The Apache HTTP Server

Fura, tenyleg, mert lathatoan nalam ott van, ahogy kell. Mondjuk ez CentOS, meg eleve csak RH-fele rendszereket hasznalok.

A systemd szerint is rendesen fut (systemctl status..)?

Érdekes. A "systemctl status apache2" kimenete:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2020-11-13 08:54:00 CET; 1h 43min ago
  Process: 23930 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 23925 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

De a "systemctl --all | grep apache" kimenete:

  apache2.service             loaded    inactive dead      The Apache HTTP Server 

Közben persze a webszerver rendben fut.

Kiadtam a "systemctl restart apache2" parancsot.

Erre leállt a webszerver

Újra kiadtam ugyanezt, most már újra fut a webszerver, de már a status is azt mutatja, hogy fut, és bekerült a running listába is.

Megnéztem az apache error.log-ját, de semmi, az újraindítások megszokott üzenetein kívül.

?

cat /lib/systemd/system/apache2.service

...
Type=forking
...

 

apache hatterbe megy, de a systemd figyeli a pid alajnan. egyszer egy restartkor leallitotta, a main process le is allt, de az egyik worker process nem hallgatott ra es szepen elmaszott tole.

A vegtelen ciklus is vegeter egyszer, csak kelloen eros hardver kell hozza!

Units can be aliased (have an alternative name), by creating a symlink from the new name to the existing name in one of the unit search paths. For example, systemd-networkd.service has the alias dbus-org.freedesktop.network1.service, created during installation as a symlink, so when systemd is asked through D-Bus to load dbus-org.freedesktop.network1.service, it'll load systemd-networkd.service. As another example, default.target — the default system target started at boot — is commonly symlinked (aliased) to either multi-user.target or graphical.target to select what is started by default. Alias names may be used in commands like disable, start, stop, status, and similar, and in all unit dependency directives, including Wants=, Requires=, Before=, After=. Aliases cannot be used with the preset command.

BlackY

"Gyakran hasznos ugyanis, ha számlálni tudjuk, hányszor futott le már egy végtelenciklus." (haroldking)

Így már én is jártam!

Készítettem egy rendszert, ahol kötelező volt az apache. A dokumentációban azt is le kellett írni, hogy melyk program melyiket indítja. Egyszer csak felhív a megrendelést bonyolító leányzó:

- Kerestük a kollégámmal ezt a httpd-t de nem találtuk. Végülis nem fontos, használhatod ezt is az apache helyett.

Küldtem nekik egy linket: https://httpd.apache.org/docs/trunk/invoking.html

Ők is informatikusok voltak.

(Define informatikus: Aki mindenhez semmit sem ért.)

Van a service file-ban alias field. Valószínűleg ezért.