block icon indicating copy to clipboard operation
block copied to clipboard

[Request] Include this systemd service

Open mdjose opened this issue 3 years ago • 0 comments

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

mdjose avatar Feb 07 '22 05:02 mdjose