diff --git a/dnsmonitor.py b/BlockyGrapher.py similarity index 100% rename from dnsmonitor.py rename to BlockyGrapher.py diff --git a/BlockyGrapher.service b/BlockyGrapher.service new file mode 100644 index 0000000..0263201 --- /dev/null +++ b/BlockyGrapher.service @@ -0,0 +1,16 @@ +[Unit] +Description=Physical display query grapher for Blocky DNS Server. +After=syslog.target +After=network.target +#If you have Blocky service, its better to start grapher after it. +#After=blocky.service +[Service] +Environment=PYTHONUNBUFFERED=1 +# Change according to your setup. +User=user +Group=user +WorkingDirectory=/path/to/BlockyGrapher +ExecStart=python3 BlockyGrapher.py --i2c-port 2 --i2c-address 0x3C +KillSignal=sigterm +[Install] +WantedBy=multi-user.target diff --git a/README.md b/README.md index d69d022..525b0cb 100644 --- a/README.md +++ b/README.md @@ -100,13 +100,13 @@ SSD1306 128x64 and 128x32 displays usually have 0x3C/0x30 address. ``` We found our display! Now we can start the grapher. ``` -python3 dnsmonitor.py --i2c-port 2 --i2c-address 0x3C +python3 BlockyGrapher.py --i2c-port 2 --i2c-address 0x3C ``` Note that during first successful startup, you will need to edit newly created `config.ini` configuration file. ``` [F] [16:54:12] config.ini does not exist. Please edit newly created file and start the program. ``` -You can see all available startup options using `python3 dnsmonitor.py -h`. +You can see all available startup options using `python3 BlockyGrapher.py -h`. ## Cofiguration Unedited `config.ini` will look like this: ``` @@ -136,7 +136,18 @@ stop = 06 `stop` - Hour, when Lights OFF mode ends. ## Install as service (Autorun) -### TODO +After succssesful install, you probably want to install it as service. + +Edit `BlockyGrapher.service`. The only lines you really want to change are `User`, `Group`, `WorkingDirectory`, `ExecStart`. Also uncomment and change `After` with service name if you have one. + +Copy file. +``` +sudo cp BlockyGrapher.service /etc/systemd/system/ +``` +Start service. +``` +sudo systemctl start BlockyGrapher +``` ## Credits [Terminus Font](https://files.ax86.net/terminus-ttf/) - Font used by numbers in graph.