Como agregar rc.local en Debian 9



Configuración para agregar rc.local en Debian 9

A continuación agregaremos el archivo rc.local, en nuestro sistema basado en Debian 9, el cual en esta versión, marca como archivo descontinuado para la versión, pero que muchos de los administradores y usuarios utilizamos para cargar archivos o programas de lotes a nuestro inicio.

Primero agregaremos editaremos la línea siguiente del SystemD:

nano /etc/systemd/system/rc-local.service

Posteriormente agregaremos el siguiente contenido a dicho archivo:

[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target

Después de guardar y cerrar el archivo, ahora procederemos a crear y editar el archivo rc.local.

nano /etc/rc.local

Añadimos el siguiente texto:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0

Guardamos y cerramos, para luego conceder permisos:

chmod +x /etc/rc.local

Ahora añadiremos el archivo a nuestro reinicio de servidor:

systemctl enable rc-local

Iniciamos el script:

systemctl start rc-local.service

Verificamos si no tenemos algún error:

systemctl status rc-local.service

Con esto, podremos agregar contenido a nuestro archivo rc.local, como siempre lo hemos realizado.

Creditos: @ItechLounge

Dudas y comentarios en nuestro grupo de Telegram @PwrMX

1 Comentarios