Systemd systemctl: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 49: Zeile 49:
 
</pre>
 
</pre>
  
=== aktivieren/deaktivieren systemstart ===
 
*systemctl enable
 
*systemctl disable
 
*systemctl is-enabled
 
 
=== service steuern ===
 
=== service steuern ===
 
*systemctl start
 
*systemctl start

Version vom 24. Oktober 2017, 14:23 Uhr

Example

  • cat /etc/systemd/system/chat.service
[Unit]
Description=chat service
After=network.target syslog.target

[Service]
Type=simple
ExecStart=/bin/bash -c "/bin/netcat -l -p 3333 > /tmp/chat.log"
User=root

[Install]
WantedBy=multi-user.target

Systemctl

Reload

  • systemctl daemon-reload

Start

  • systemctl start chat.service

Stop

  • systemctl stop chat.service

Enable

  • systemctl enable chat.service
Created symlink from /etc/systemd/system/multi-user.target.wants/chat.service to /etc/systemd/system/chat.service.

Disable

  • systemctl disable chat.service
Removed symlink /etc/systemd/system/multi-user.target.wants/chat.service.

Reload

  • systemctl reload

Restart

  • systemctl restart

Is enabled

  • systemctl is-enabled chat.service
disabled

Status

  • systemctl status chat.service
● chat.service - chat service
   Loaded: loaded (/etc/systemd/system/chat.service; disabled; vendor preset: enabled)
   Active: active (running) since Di 2017-10-24 16:20:26 CEST; 17s ago
 Main PID: 10949 (bash)
   CGroup: /system.slice/chat.service
           ├─10949 /bin/bash -c /bin/netcat -l -p 3333 > /tmp/chat.log
           └─10951 /bin/netcat -l -p 3333

Okt 24 16:20:26 bajor.xinux.lan systemd[1]: Started chat service.

service steuern

  • systemctl start
  • systemctl stop
  • systemctl status

service files anzeigen

  • systemctl list-units
  • systemctl list-unit-files
  • systemctl --failed

rechner herunterfahren

  • systemctl isolate halt
  • systemctl poweroff
  • systemctl suspend
  • systemctl hibernate