Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Latest commit

 

History

History
45 lines (28 loc) · 1.64 KB

README.md

File metadata and controls

45 lines (28 loc) · 1.64 KB

network-shutdown

A little script that exposes an API for power management over the network

MIT License

WARNING: Do NOT use this in insecure or publicly available networks. There is currently no authentication mechanism to prevent unauthorized access.

Installation

Clone the repository, create a virtual environment in the directory .venv and install all dependencies:

git clone https://github.com/danieldirks/network-shutdown.git
cd network-shutdown
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
deactivate

If you want to use an other name for the virtual environment or want to use the system interpreter (which I would not recommend), you need to change the references in start.sh.

You can now create an autostart job for start.sh to run the server on every startup.

Configuration

The config.ini contains all configuration keys and is mostly self-explaining. It currently uses systemctl for power management to allow running without privileges.

The default port for the API is 48080.

Features

I wrote the script to let my smart home system shutdown my computer.

The script exposes a REST API with flask-restful which allows the following requests:

License

The project is licensed under the MIT License.