2022-01-09 15:57:29 +00:00
|
|
|
# GPIO pin setup
|
2021-11-08 20:35:03 +00:00
|
|
|
|
2022-01-09 15:57:29 +00:00
|
|
|
<img src="https://git.ping-mee.de/ebbe.bass/server-rack-led/raw/branch/master/GPIO%20Pin.png">
|
|
|
|
|
2022-03-11 10:28:17 +00:00
|
|
|
# Install Python script as service
|
2022-01-09 15:57:29 +00:00
|
|
|
|
2022-03-11 10:28:17 +00:00
|
|
|
Requirements:
|
|
|
|
- systemd (sudo apt install systemd -y)
|
|
|
|
|
|
|
|
Create service file:
|
2022-03-11 10:31:34 +00:00
|
|
|
`sudo nano /etc/systemd/system/server-rack-led.service`
|
|
|
|
|
|
|
|
Content in the service file:
|
|
|
|
```
|
|
|
|
[Unit]
|
|
|
|
Description=Server Rack LED
|
2022-03-11 10:32:39 +00:00
|
|
|
After=multi-user.target
|
|
|
|
|
|
|
|
[Service]
|
2022-03-11 10:31:34 +00:00
|
|
|
Type=simple
|
|
|
|
Restart=always
|
|
|
|
ExecStart=/usr/bin/python3 /home/pi/server-rack-led/main.py
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
```
|
|
|
|
|
|
|
|
Reload daemon, enable service and start service:
|
|
|
|
```
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
sudo systemctl enable server-rack-led.service
|
|
|
|
sudo systemctl start server-rack-led.service
|
|
|
|
```
|