>_CentOS 7 – Systemctl start – stop – enable – disable

Systemd é um sistema e gerenciador de serviços para Linux, compatível com os scripts de inicializações SysV e LS. Systemd fornece recursos de paralelização agressivos, usa socket e ativação D-Bus para iniciar serviços, oferece o início de daemons on-demand, mantém o registro de processos usando grupos de controle Linux, suporte snapshotting e restauração do estado do sistema, preserva pontos de montagens e automontagens e implementa uma lógica de controle elaborado transacional baseada em dependência de serviço.

Uso básico systemctl

O principal comando usado para introspecção e controle systemd é systemctl. Alguns de seus usos são examinando o estado do sistema e gerenciando o sistema e serviços. Consulte man 1 systemctl para mais detalhes.

Exemplos rápidos:

Mascarando uma unidade (desabilitando)

# systemctl mask firewalld
ln -s '/dev/null' '/etc/systemd/system/firewalld.service'

Desmascarando uma unidade (Habilitando)

# systemctl unmask firewalld

Habilitando

# systemctl enable firewalld
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
ln -s '/usr/lib/systemd/system/firewalld.service' '/etc/systemd/system/basic.target.wants/firewalld.service'

Desabilitando

# systemctl disable firewalld
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'

Stop

# systemctl stop firewalld

Start

# systemctl start firewalld

Habilitando

# systemctl enable iscsid
ln -s '/usr/lib/systemd/system/iscsid.service' '/etc/systemd/system/multi-user.target.wants/iscsid.service'
# systemctl is-enabled iscsid
enabled

Desabilitando

# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

Status

# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: inactive (dead)

Conferindo o status de um serviço

#  systemctl is-enabled firewalld
disabled
#  systemctl is-enabled firewalld.service
disabled

Verificando todos os serviços

#  systemctl -t service 
UNIT                                  LOAD   ACTIVE SUB     DESCRIPTION
auditd.service                        loaded active running Security Auditing Service
avahi-daemon.service                  loaded active running Avahi mDNS/DNS-SD Stack
chronyd.service                       loaded active running NTP client/server
crond.service                         loaded active running Command Scheduler
dbus.service                          loaded active running D-Bus System Message Bus
getty@tty1.service                    loaded active running Getty on tty1
iprdump.service                       loaded active running LSB: Start the ipr dump daemon
iprinit.service                       loaded active running LSB: Start the ipr init daemon
iprupdate.service                     loaded active running LSB: Start the iprupdate utility
irqbalance.service                    loaded active running irqbalance daemon
kdump.service                         loaded active exited  Crash recovery kernel arming
kmod-static-nodes.service             loaded active exited  Create list of required static device nodes for the current kernel
network.service                       loaded failed failed  LSB: Bring up/down networking
NetworkManager.service                loaded active running Network Manager
polkit.service                        loaded active running Authorization Manager
postfix.service                       loaded active running Postfix Mail Transport Agent
rhel-dmesg.service                    loaded active exited  Dump dmesg to /var/log/dmesg
rhel-import-state.service             loaded active exited  Import network configuration from initramfs
rhel-readonly.service                 loaded active exited  Configure read-only root support
rsyslog.service                       loaded active running System Logging Service
sshd.service                          loaded active running OpenSSH server daemon
systemd-backlight@acpi_video0.service loaded active exited  Load/Save Screen Backlight Brightness of acpi_video0
systemd-fsck-root.service             loaded active exited  File System Check on Root Device
systemd-journald.service              loaded active running Journal Service
systemd-logind.service                loaded active running Login Service
systemd-random-seed.service           loaded active exited  Load/Save Random Seed
systemd-readahead-collect.service     loaded active exited  Collect Read-Ahead Data
systemd-readahead-replay.service      loaded active exited  Replay Read-Ahead Data
systemd-remount-fs.service            loaded active exited  Remount Root and Kernel File Systems
systemd-sysctl.service                loaded active exited  Apply Kernel Variables
systemd-tmpfiles-setup-dev.service    loaded active exited  Create static device nodes in /dev
systemd-tmpfiles-setup.service        loaded active exited  Create Volatile Files and Directories
systemd-udev-trigger.service          loaded active exited  udev Coldplug all Devices
systemd-udevd.service                 loaded active running udev Kernel Device Manager
systemd-update-utmp.service           loaded active exited  Update UTMP about System Reboot/Shutdown
systemd-user-sessions.service         loaded active exited  Permit User Sessions
systemd-vconsole-setup.service        loaded active exited  Setup Virtual Console
tuned.service                         loaded active running Dynamic System Tuning Daemon
>_CentOS 7 – Systemctl start – stop – enable – disable
Tagged on:

One thought on “>_CentOS 7 – Systemctl start – stop – enable – disable

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

%d blogueiros gostam disto: