La forma convencional utilizada para cambiar el nivel de ejecución usando /etc/inittab se ha vuelto obsoleto con Redhat Enterprise Linux versión 7. Como resultado, cualquier sistema Linux que use systemd El demonio de administración del sistema ahora se basa en systemctl comando para cambiar el nivel de ejecución o para ser más precisos para cambiar el objetivo. Como resultado, cualquier edición de /etc/inittab no tendrá efecto en RHEL 7. El término runlevel todavía existe en RHEL 7 y podemos verificar el nivel de ejecución actual usando runlevel comando:
[root@rhel7 ~]# runlevel N 3
Sin embargo, con respecto a RHEL 7, en lugar de nivel de ejecución, hablamos de objetivos. Por ejemplo, para enumerar todos los objetivos cargados actualmente, podemos usar el siguiente comando de Linux:
[root@rhel7 ~]# systemctl list-units -t target UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System cryptsetup.target loaded active active Encrypted Volumes getty.target loaded active active Login Prompts local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User System network.target loaded active active Network paths.target loaded active active Paths remote-fs.target loaded active active Remote File Systems slices.target loaded active active Slices sockets.target loaded active active Sockets swap.target loaded active active Swap sysinit.target loaded active active System Initialization timers.target loaded active active Timers LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 14 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
Actualmente, nuestro sistema ejecuta el nivel de ejecución 3, que es multi-user.target . A continuación, podemos enumerar todos los objetivos de nivel de ejecución disponibles usando el siguiente comando:
[root@rhel7 ~]# systemctl list-units -t target -a UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System cryptsetup.target loaded active active Encrypted Volumes emergency.target loaded inactive dead Emergency Mode final.target loaded inactive dead Final Step getty.target loaded active active Login Prompts graphical.target loaded inactive dead Graphical Interface local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User System network-online.target loaded inactive dead Network is Online network.target loaded active active Network nss-lookup.target loaded inactive dead Host and Network Name Lookups nss-user-lookup.target loaded inactive dead User and Group Name Lookups paths.target loaded active active Paths remote-fs-pre.target loaded inactive dead Remote File Systems (Pre) remote-fs.target loaded active active Remote File Systems rescue.target loaded inactive dead Rescue Mode shutdown.target loaded inactive dead Shutdown slices.target loaded active active Slices sockets.target loaded active active Sockets swap.target loaded active active Swap sysinit.target loaded active active System Initialization syslog.target not-found inactive dead syslog.target time-sync.target loaded inactive dead System Time Synchronized timers.target loaded active active Timers umount.target loaded inactive dead Unmount All Filesystems LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 26 loaded units listed. To show all installed unit files use 'systemctl list-unit-files'.
El administrador del sistema puede activar cualquiera de los objetivos anteriores. Por ejemplo, activando graphical.target cambiaremos efectivamente del nivel de ejecución 3 al nivel de ejecución GUI 5. Para hacer eso, una vez más usamos systemctl comando:
[root@rhel7 ~]# systemctl enable graphical.target --force rm '/etc/systemd/system/default.target' ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'
Como se muestra en la salida anterior, systemctl El comando cambió el objetivo predeterminado al crear un enlace simbólico en /etc/systemd/system/default.target por lo que es un destino de arranque predeterminado.