EnergizedProtection / block

Let's make an annoyance free, better open internet, altogether!
https://energized.pro
MIT License
2.47k stars 198 forks source link

[Request] Include this systemd service #881

Open mdjose opened 2 years ago

mdjose commented 2 years ago

I wrote a simple systemd service that updates the hosts file weekly. It would be useful for Linux users if it was included in the documentation.

/usr/lib/systemd/system/update-hosts.service

[Unit]
Description=Update the hosts file
Documentation=https://github.com/EnergizedProtection/block

[Service]
Type=oneshot
ExecStartPre=wget https://block.energized.pro/unified/formats/hosts -O /tmp/hosts.tmp
ExecStart=mv /tmp/hosts.tmp /etc/hosts
ExecStartPost=rm -rf /tmp/hosts.tmp

[Install]
WantedBy=multi-user.target

/usr/lib/systemd/system/update-hosts.timer

[Unit]
Description=Update the hosts file weekly

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
RandomizedDelaySec=100min

[Install]
WantedBy=timers.target