Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd timer and modify cron instructions #262

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 43 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,58 @@ cd /opt/
sudo git clone https://github.com/anudeepND/whitelist.git
```

Make the script to run the script at 1AM on the last day of the week
Make the script to run the script once a week

```Shell
sudo nano /etc/crontab
sudo nano /etc/cron.weekly/whitelist
```

Add this line at the end of the file:
Add this to the file:

```Text
0 1 * * */7 root /opt/whitelist/scripts/whitelist.py
```bash
#! /usr/bin/env bash

python3 /opt/whitelist/scripts/whitelist.py
```

CTRL + X then Y and Enter
### systemd

Make the timer to run the script once a week

```Shell
sudo python3 whitelist/scripts/whitelist.py
sudo nano /etc/systemd/system/whitelist.timer
```

Add this to the file:

```conf
[Unit]
Description=Timer for reloading Pi-Hole Whitelist

[Timer]
OnCalendar=Sun *-*-* 01:00:00
AccuracySec=1h
RandomizedDelaySec=6h

[Install]
WantedBy=timers.target
```

Make the script to run the script

```shell
sudo nano /etc/systemd/system/whitelist.service
```

Add this to the file:

```conf
[Unit]
Description=Pi-Hole Whitelist update

[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /opt/whitelist/scripts/whitelist.py
```

## <ins>How do I determine an ad domain?</ins>
Expand Down