Paho MQTT and autorun [message #1835934] |
Wed, 16 December 2020 19:54 |
Roby Roby Messages: 1 Registered: December 2020 |
Junior Member |
|
|
Hi all,
I am trying to run a python script when RP starts.
The script controls the processor temperature and automatically adjusts the fan speed to generate more or less airflow.
I tried with crontab, in rc.local and now i'm trying to start services automatically using systemctl and the script is working well, but the only problem is that it doesn't publish via mqtt the fan speed.
If i try to launch script manually it works well and value will be published correctly, so i think that the problem is paho at startup that seems doesn't work.
I also put a time sleep before publishing starts but there is no way it works again.
Do you have any suggestion?
This is my service:
[Unit]
After=network.target mosquitto.service
Requires=mosquitto.service
Wants=network.target
[Service]
ExecStart=/usr/bin/python -u fan.py
WorkingDirectory=/home/pi/script
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
Thank you
|
|
|
Powered by
FUDForum. Page generated in 0.03258 seconds