Wednesday, 11 May 2022

ubuntu rc.local for executing sudo dhclinet to start network

 https://unix.stackexchange.com/questions/49626/purpose-and-typical-usage-of-etc-rc-local


https://askubuntu.com/questions/193074/have-to-run-sudo-dhclient-eth0-automatically-every-boot



The script /etc/rc.local is for use by the system administrator. It is traditionally executed after all the normal system services are started, at the end of the process of switching to a multiuser runlevel. You might use it to start a custom service, for example a server that's installed in /usr/local. Most installations don't need /etc/rc.local, it's provided for the minority of cases where it's needed.



#!/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.
sudo dhclient <networkinterfacename>
sudo systemctl start systemd-resolved
exit 0

No comments:

Post a Comment