Pada artikel sebelumnya kita telah membahas bagaimana systemctl ini melakukan manajemen untuk service-service yang ada Centos 7. Kemudian kita mungkin bertanya-tanya di mana letak file service ini ? Pada artikel kali ini kita akan membahas mengenai lokasi directory dari service-service yang ada Centos 7.

Letak directory yang berisi service-service ini ada di /usr/lib/systemd/system . Berikut kita akan mencoba hal-hal berikut ini

  1. Melihat daftar beberapa service
    Service-service ini memiliki extention service. Kita dapat melihat contoh beberapa service seperti berikut ini

    [root@localhost ~]# ls /usr/lib/systemd/system | grep “d.service”
    auditd.service
    crond.service
    httpd.service
    lvm2-lvmetad.service
    lvm2-lvmpolld.service
    mcstransd.service
    nfs-rquotad.service
    rpcbind.service
    rpc-rquotad.service
    sshd.service
    systemd-hostnamed.service
    systemd-journald.service
    systemd-localed.service
    systemd-logind.service
    systemd-machined.service
    systemd-modules-load.service
    systemd-random-seed.service
    systemd-shutdownd.service
    systemd-suspend.service
    systemd-timedated.service
    systemd-udevd.service
    tcsd.service
    tuned.service
    vsftpd.service

  2. Melihat isi salah satu service
    Kita akan melihat salah satu dari service seperti contoh berikut ini

    [root@localhost ~]# cat /usr/lib/systemd/system/httpd.service
    [Unit]
    Description=The Apache HTTP Server
    After=network.target remote-fs.target nss-lookup.target
    Documentation=man:httpd(8)
    Documentation=man:apachectl(8)

    [Service]
    Type=notify
    EnvironmentFile=/etc/sysconfig/httpd
    ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
    ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
    ExecStop=/bin/kill -WINCH ${MAINPID}
    # We want systemd to give httpd some time to finish gracefully, but still want
    # it to kill httpd after TimeoutStopSec if something went wrong during the
    # graceful stop. Normally, Systemd sends SIGTERM signal right after the
    # ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
    # httpd time to finish.
    KillSignal=SIGCONT
    PrivateTmp=true

    [Install]
    WantedBy=multi-user.target

  3. Melakukan manajemen dengan fullname
    Kita dapat melakukan manajemen dengan fullname seperti contoh berikut ini

    [root@localhost ~]# systemctl status httpd.service
    â httpd.service – The Apache HTTP Server
       Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2016-09-29 18:56:27 WIB; 1 day 1h ago
         Docs: man:httpd(8)
               man:apachectl(8)
     Main PID: 11581 (httpd)
       Status: “Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec”
       CGroup: /system.slice/httpd.service
               ââ11581 /usr/sbin/httpd -DFOREGROUND
               ââ11615 /usr/sbin/httpd -DFOREGROUND
               ââ11616 /usr/sbin/httpd -DFOREGROUND
               ââ11617 /usr/sbin/httpd -DFOREGROUND
               ââ11618 /usr/sbin/httpd -DFOREGROUND
               ââ11619 /usr/sbin/httpd -DFOREGROUND

    Sep 29 18:56:27 localhost.localdomain systemd[1]: Starting The Apache HTTP Server…
    Sep 29 18:56:27 localhost.localdomain httpd[11581]: AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.l…s message
    Sep 29 18:56:27 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
    Sep 29 19:01:05 localhost.localdomain httpd[11613]: AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.l…s message
    Sep 29 19:01:05 localhost.localdomain systemd[1]: Reloaded The Apache HTTP Server.
    Hint: Some lines were ellipsized, use -l to show in full.

  4. Melakukan manajemen dengan nama depan
    Kita dapat melakukan manajemen memanggil nama depannya seperti contoh berikut ini:

    [root@localhost ~]# 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 Thu 2016-09-29 18:56:27 WIB; 1 day 1h ago
         Docs: man:httpd(8)
               man:apachectl(8)
     Main PID: 11581 (httpd)
       Status: “Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec”
       CGroup: /system.slice/httpd.service
               ââ11581 /usr/sbin/httpd -DFOREGROUND
               ââ11615 /usr/sbin/httpd -DFOREGROUND
               ââ11616 /usr/sbin/httpd -DFOREGROUND
               ââ11617 /usr/sbin/httpd -DFOREGROUND
               ââ11618 /usr/sbin/httpd -DFOREGROUND
               ââ11619 /usr/sbin/httpd -DFOREGROUND

    Sep 29 18:56:27 localhost.localdomain systemd[1]: Starting The Apache HTTP Server…
    Sep 29 18:56:27 localhost.localdomain httpd[11581]: AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.l…s message
    Sep 29 18:56:27 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
    Sep 29 19:01:05 localhost.localdomain httpd[11613]: AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.l…s message
    Sep 29 19:01:05 localhost.localdomain systemd[1]: Reloaded The Apache HTTP Server.
    Hint: Some lines were ellipsized, use -l to show in full.

Informasi lebih lanjut silahkan mengunjungi https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Services.html.

Kunjungi www.proweb.co.id untuk menambah wawasan anda.

Directory service pada Centos 7