Aquesta és una revisió antiga del document
LPIC2 2021 Sesión 4 (2021-02-11)
Curso
Documentación relacionada 202
- Presentaciones/2020/201/202 - Arranque del Sistema.pdf
SystemV
SystemD
- levanta los servicios de manera paralela
systemd-cgls: procesos en arbolsystemd-cgtopsystemd-analyzeblame: tiempos de arranque de los servicios, para ver quien es el lentoplot > /var/www/html/plot.html
Units
- service
- socket
- device
- mount
- automount
- target (runlevels)
- snapshot
- cgroups: gestión en caliente de CPU,RAM,DISCO
- service es unit por defecto (se puede omitir en los comandos)
systemctl <accion> <unidad>- start
- stop
- enable: activa en el arranque
- enable –now
- disable
- reload
- status
targets
- los runlevels en systemV
- cat /etc/inittab
- runlevelX.target o <NOMBRE>.target
- 0: halt?
- 1: rescue.target
- 2:
- 3:
- 4: multi-user.target
- 5: graphical.target
- 6: reboot.target
systemctl get-defaultsystemctl set-default <TARGET>.targetsystemctl isolate <TARGET>.target→ init o telinit en systemV
snapshot
mask
- para e impide ejecución de un servicio (o unidad?)
systemctl mask nombre.servicesystemctl unmask nombre.service
laboratorio1
- Material Practicas LPIC-2/LPIC-201/3-System Startup/SystemD/Laboratorio 1 Gestion de servicios con systemctl:
systemctl list-units –type service: servicios activossystemctl list-units –type service –all: servicios activos e inactivossystemctl start|stop|restart|try-restart|reload|status|is-enabled|is-active nombre.service: operaciones con servicios- try-restart: solo hace restart si está arrancado
systemctl enable|disable nombre.servicio: activar en arranquesystemctl kill [-s SIGKILL] nombre.servicio: parar serviciossystemctl reboot|halt|poweroff: reboot, haltsystemctl mask|unmask: enmascara un servicio, impide que se ponga en marcha
Laboratorio 2
- Material Practicas LPIC-2/LPIC-201/3-System Startup/SystemD/Laboratorios-2 Systemd:, página 9
- units propias: /etc/systemd/system/
- no funciona mask
- /usr/lib/systemd/system/: unidades distribuidos con paquetes instalados
- /run/systemd/system/: unidades creadas en tiempo de ejecución. Tiene tiene precedencia sobre el directorio anterior
- /etc/systemd/system/: unidades creadas y administradas por el administrador del sistema
systemctl cat <unit>: muestra el contenido y ubicación del archivosystemctl edit --full <unit>: editar la unidad- archivos .service personalizados
cd /opt/scripts chmod 700 supervisamem chmod 700 /etc/init.d/iniciar-supervisamema
cd /etc/systemd/system vi supervisamem.service
[Unit] Description=Daemon of axample [Service] ExecStart=/etc/init.d/iniciar-supervisamem start ExecStop=/etc/init.d/iniciar-supervisamem stop Type=forking [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl start supervisamem.service tail -f /var/log/supervisamem.log systemctl stop supervisamem systemctl enable suspervisamem.service systemd-cgtop