Last active
June 12, 2023 20:10
-
-
Save catleeball/835441348ffd4799a91c14df3d270fe5 to your computer and use it in GitHub Desktop.
Simple cron job to update host file with spam block list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Simple cron job to update host file with spam block list | |
# /etc/cron.daily/hosts_update.sh | |
wget -q https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -O /tmp/hosts | |
if ! cmp /tmp/hosts /etc/hosts >/dev/null 2>&1; then | |
mv /tmp/hosts /etc/hosts | |
else | |
rm /tmp/hosts | |
fi | |
# Restart your system's network daemon to pick up new changes | |
# This can vary by distro! You may want to change this! | |
systemctl restart systemd-networkd |
I would still add service network-manager restart
to be sure dns cache is cleaned up
good callout @jfoclpf ! I'll update this with a note
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, I guess I just need to add this file to
/etc/cron.daily
to be run by anacron