#!/bin/sh
service=$1
if 
  systemctl | grep -q "$service"
then
  systemctl status "$service"
else
  echo "The service doesn't exist"
fi
Komut Satırı Seçenekleri
Giriş
Kullanım : systemctl + seçenek + servis_ismi şeklindedir.
daemon-reload seçeneği
/etc/systemd/system/ dizini altındaki dosyalarda bir ayar değiştiyse kullanılır. Şöyle 
yaparız.
systemctl daemon-reload
Daha sonra yeni servisi veya değişen servisi tekrar durdurup başlatmak gerekir. Şöyle 
yaparızsudo systemctl start zookeeper
sudo systemctl status zookeeper
Açıklaması 
şöyle.
Running systemctl disable removes the symlink to the service in /etc/systemd/system/*.
From now on, that service won't start on boot anymore.
Örnek
Şöyle 
yaparız.
systemctl disable snmpd
Örnek
Şöyle 
yaparız.
sudo systemctl disable apache2
enable seçeneği
Örnek
Şöyle 
yaparız.
sudo systemctl enable /etc/systemd/system/macoverride.service
Örnek
Eğer tek bir komut ile enable + start yapmak istersek şöyle 
yaparız
systemctl enable --now
is-active seçeneği
Örnek
Şöyle 
yaparız.
systemctl is-active --quiet myservice
Örnek
Şöyle 
yaparız.
systemctl is-active --quiet service && echo Service is running
isolate seçeneği
Kendi dosyamı çalıştırmak için şöyle 
yaparız.
# systemctl isolate maintenance.target
Belli bir seviyedeki servisleri çalıştırmak için şöyle 
yaparız.
# systemctl isolate multi-user.target
list-unit seçeneği
Açıklaması şöyle
systemd units can be listed with systemctl list-units for currently active and systemctl -a list-units for all known units.
Örnek
Şöyle 
yaparız.
systemctl list-units | grep -E 'service.*running'
mask seçeneği
Örnek - poweroff yeteneğini iptal etme
sudo systemctl mask poweroff.target
...
sudo systemctl unmask poweroff.target
reboot seçeneği
 (Unified Extensible Firmware Interface) ekranına girebilmeyi sağlar.
Örnek
Şöyle 
yaparız
systemctl reboot --firmware-setup
restart seçeneği
Örnek
Şöyle 
yaparız.
systemctl restart NetworkManager
Örnek
Şöyle 
yaparız.
systemctl restart sshd
show seçeneği
Açıklaması 
şöyle.
Show properties of one or more units, jobs, or the manager itself. If no argument is specified, properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and if a job ID is specified, properties of the job are shown. By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=. This
command is intended to be used whenever computer-parsable output is required. Use status if you are looking for formatted human-readable output.
Şöyle 
yaparız.
$ systemctl show -p SubState --value NetworkManager
running
Şöyle 
yaparız.
$ systemctl show -p ActiveState --value x11-common
inactive
$ systemctl show -p SubState --value x11-common
dead
start seçeneği
Şöyle 
yaparız.
systemctl enable ssmatt.service
systemctl start ssmatt.service
status seçeneği
Örnek
Tüm servisleri görmek için şöyle yaparız.
systemctl status
Çıktı olarak ağaç yapısı 
alırız.
├─systemd-journald.service
         │ └─318 /lib/systemd/systemd-journald
         ├─fwupd.service
         │ └─1703 /usr/lib/fwupd/fwupd
         ├─systemd-networkd.service
         │ └─395 /lib/systemd/systemd-networkd
         └─cups-browsed.service
           └─2918 /usr/sbin/cups-browsed
lines 172-194/194 (END)
Örnek - servis ismi
Servis ismi olarak x.service ye da sadece x kullanılabilir.
Şöyle 
yaparız.
systemctl status bluetooth
 bluetooth.service - Bluetooth service
  Loaded: loaded ...
  Active: inactive (dead)
     Docs: man:bluetoothd(8)
Şöyle 
yaparız
systemctl status sshd
Örnek - pid
Elimizde şöyle bir bilgi 
olsun.
systemd(1)───foo(37775)─┬─{foo1}(37782)
                        ├─{foo2}(37783)
                        └─{foo3}(37784)
Şöyle 
yaparız.
$ systemctl status 37775
stop seçeneği
Örnek
Şöyle 
yaparız
systemctl stop snmpd
Örnek
Normalde şöyle yapmak 
gerekir.
systemctl stop media-backup.automount
servis ismi için dosya yolu kullanmak istersek şöyle 
yaparız.
systemctl stop "$(systemd-escape -p --suffix=automount /media/backup)"
-t seçeneği
type anlamına gelir. Açıklaması 
şöyle.
-t, --type=
       The argument should be a comma-separated list of unit types such as
       service and socket.
       If one of the arguments is a unit type, when listing units, limit
       display to certain unit types. Otherwise, units of all types will
       be shown.
       As a special case, if one of the arguments is help, a list of
       allowed values will be printed and the program will exit.
   --state=
       The argument should be a comma-separated list of unit LOAD, SUB, or
       ACTIVE states. When listing units, show only those in the specified
       states. Use --state=failed to show only failed units.
       As a special case, if one of the arguments is help, a list of
       allowed values will be printed and the program will exit.
Çalışmakta olan servisleri görmek için şöyle 
yaparız.
systemctl --type=service --state=running list-units
--user seçeneği