Systemd systemctl: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Thomas (Diskussion | Beiträge) |
Thomas (Diskussion | Beiträge) |
||
| Zeile 35: | Zeile 35: | ||
*systemctl is-enabled chat.service | *systemctl is-enabled chat.service | ||
disabled | disabled | ||
| + | ==Mask== | ||
| + | *systemctl mask apache2 | ||
| + | Created symlink from /etc/systemd/system/apache2.service to /dev/null. | ||
| + | ==Umask== | ||
| + | *systemctl unmask apache2 | ||
| + | Removed symlink /etc/systemd/system/apache2.service. | ||
| + | |||
==Status== | ==Status== | ||
*systemctl status chat.service | *systemctl status chat.service | ||
Version vom 24. Oktober 2017, 14:33 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
Mask
- systemctl mask apache2
Created symlink from /etc/systemd/system/apache2.service to /dev/null.
Umask
- systemctl unmask apache2
Removed symlink /etc/systemd/system/apache2.service.
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.
List Units
- systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION proc-sys-fs-binfmt_misc.automount loaded active running Arbitrary Executable File Formats File System Automount Point sys-devices-LNXSYSTM:00-LNXSYBUS:00-PNP0A08:00-device:02-ATK0110:00-hwmon-hwmon1.device loaded active plugged /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:02/ATK0110:00/hwmon/hwmon1 sys-devices-pci0000:00-0000:00:01.0-0000:01:00.0-hwmon-hwmon0.device loaded active plugged /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon0 ...
List Unit Files
- systemctl list-unit-files
UNIT FILE STATE proc-sys-fs-binfmt_misc.automount static dev-hugepages.mount static dev-mqueue.mount static mnt-data.mount enabled mnt-media.mount enabled proc-fs-nfsd.mount static proc-sys-fs-binfmt_misc.mount static run-rpc_pipefs.mount static sys-fs-fuse-connections.mount static sys-kernel-config.mount static sys-kernel-debug.mount static acpid.path enabled cups.path enabled systemd-ask-password-console.path static systemd-ask-password-plymouth.path static systemd-ask-password-wall.path static systemd-networkd-resolvconf-update.path static accounts-daemon.service enabled acpid.service disabled
Failed
- systemctl --failed
0 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
Isolate Halt
- systemctl isolate halt
Poweroff
- systemctl poweroff
Suspend
- systemctl suspend
Hibernate
- systemctl hibernate