53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
Was needs to be done on the Raspberry pi before the tool can run.
|
|
|
|
1) Set the network-card to a fixed IP adress:
|
|
- Using sudo nmtui
|
|
- Adress was set to 10.0.0.111
|
|
|
|
2) Virtual Environment was created and python packages installed
|
|
- python3 -m vemv allmende_ems
|
|
- source allmende_ems/bin/activate
|
|
- cd projects/allmende_ems
|
|
- pip install -r requirements.txt
|
|
|
|
|
|
3) How to run the script for testing:
|
|
|
|
nohup python main.py > terminal_log 2>&1 &
|
|
|
|
For reading out the terminal_log while script is runing:
|
|
|
|
tail -f terminal_log
|
|
|
|
|
|
4) Implement and run the ems as systemd service:
|
|
create:
|
|
/etc/systemd/system/allmende_ems.service
|
|
|
|
insert:
|
|
[Unit]
|
|
Description=Allmende EMS Python Script
|
|
After=network.target
|
|
|
|
[Service]
|
|
WorkingDirectory=/home/pi/projects/allmende_ems
|
|
ExecStart=/home/pi/allmende_ems/bin/python3.11 /home/pi/projects/allmende_ems/main.py
|
|
Restart=always
|
|
RestartSec=5
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|
|
manage the service with the following commands:
|
|
Once:
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl start allmende_ems.service
|
|
sudo systemctl enable allmende_ems.service
|
|
While running:
|
|
sudo systemctl status allmende_ems.service
|
|
sudo systemctl restart allmende_ems.service
|
|
sudo systemctl stop allmende_ems.service
|
|
journalctl -u allmende_ems.service
|