My /etc/resolv.conf
file gets reset every time I restart my system, so it’s likely being managed by a network management service or my system’s DHCP client. This didn’t happen with my previous build, so I need to take action. Here’s what I need to do:
- Create the Script:
sudo nano /usr/local/bin/set-dns.sh
Add the following lines:
#!/bin/bash
echo "nameserver 1.1.1.1" > /etc/resolv.conf
echo "nameserver 1.0.0.1" >> /etc/resolv.conf
2. Make it executable
sudo chmod +x /usr/local/bin/set-dns.sh
3. Create a Systemd Service: Create a service to run the script at startup:
sudo nano /etc/systemd/system/set-dns.service
Add the following content:
[Unit]
Description=Set DNS on Boot
[Service]
Type=oneshot
ExecStart=/usr/local/bin/set-dns.sh
[Install]
WantedBy=multi-user.target
4. Enable the Service:
sudo systemctl enable set-dns.service
And we’re done for tis part. But there’s something else. LiteSpeed appears to have problems with all WordPress scheduled tasks that last more than a very short time – including all backup plugins. Adding this in an early position in the .htaccess file in your WordPress root folder may fix the problem:
RewriteRule .* - [E=noabort:1]