Change program name and add service file.

This commit is contained in:
Nikopol 2024-12-17 20:39:28 +04:00
parent 47824edc51
commit 09182ab7b4
3 changed files with 30 additions and 3 deletions

16
BlockyGrapher.service Normal file
View File

@ -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

View File

@ -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.