https://github.com/devmatteini/pihole-switch
A command line tool to enable/disable your pihole
https://github.com/devmatteini/pihole-switch
cli pihole rust-lang
Last synced: 18 days ago
JSON representation
A command line tool to enable/disable your pihole
- Host: GitHub
- URL: https://github.com/devmatteini/pihole-switch
- Owner: devmatteini
- License: mit
- Created: 2020-10-18T18:13:43.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-25T22:37:45.000Z (about 1 year ago)
- Last Synced: 2025-10-20T06:58:11.040Z (6 months ago)
- Topics: cli, pihole, rust-lang
- Language: Rust
- Homepage:
- Size: 258 KB
- Stars: 13
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pihole Switch


A command line tool to enable/disable your [pihole](https://pi-hole.net/)

Sometimes you just need to disable your pihole for some website to work.
_**PiholeSwitch** makes this operation much easier_.
Just open a terminal, and you can disable pihole in a moment and for as long as you want.
## Table of contents
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
## Installation
### Recommended
```bash
curl -s https://raw.githubusercontent.com/devmatteini/pihole-switch/main/install.sh | bash
```
Download the [latest release](https://github.com/devmatteini/pihole-switch/releases/latest)
and unzip the `phs.zip` file.
After the archive is unzipped, move the `phs` binary in a folder included in your `$PATH` (it's commonly used
`/usr/local/bin`).
### From DRA
Using [`dra`](https://github.com/devmatteini/dra) you can download and install the latest release
```bash
dra download -s phs.zip --install devmatteini/pihole-switch
./phs --version
```
### From source
```bash
git clone https://github.com/devmatteini/pihole-switch && cd pihole-switch
cargo build --release
./target/release/phs
```
## Usage
Export an environment variable `PIHOLE_TOKEN=`.
You can find the api token here: http://pi.hole/admin/settings.php?tab=api, then under the section `Query log`, click on
the button `Show API token` and confirm.
### Commands
Enable pihole
```bash
phs enable
```
Disable pihole (indefinitely)
```bash
phs disable
```
Disable pihole for 20 seconds
```bash
phs disable --time 20
```
If your device doesn't have pihole set as dns
```bash
phs --host 192.168.1.50 disable
```
(where `192.168.1.50` is the pihole ip address)
Enable/disable by passing the api token as an option, instead of using the `PIHOLE_TOKEN` environment variable
```bash
phs --token
```
_**Note: the api token passed as an option will always have priority on the `PIHOLE_TOKEN` environment variable**_
## License
`pihole-switch` is made available under the terms of the MIT License.
See the [MIT License](LICENSE) file for license details.