Giter Club home page Giter Club logo

Comments (6)

flyte avatar flyte commented on May 27, 2024 1

If you've installed the project into a virtualenv, you need to make sure you're using the right python binary. Change the command line to something like:

command=/path/to/your/virtualenv/bin/python -m pi_mqtt_gpio.server /home/pi/pi-mqtt-gpio-config.yml

I've updated the readme to contain a section about using supervisor. Try setting it up like that if it still doesn't work.

from mqtt-io.

flyte avatar flyte commented on May 27, 2024

Hey @someinternetguy thanks for saying so! I'm glad it's of use for you.

I tend to use supervisor to run my programs as services. You can tell it to save the output of the program as a log file, and handles the log rotation for you. I should probably add an example deployment really. I'll leave this issue open as a reminder of that.

Hope that helps.

from mqtt-io.

steubens avatar steubens commented on May 27, 2024

@flyte, an example would be most helpful... I have used supervisord before but the setup has always come prepackaged. Anyhow, thanks for the idea... I'll take a look and see if I can figure it out.

from mqtt-io.

steubens avatar steubens commented on May 27, 2024

@flyte I was able to get supervisord on raspbian running after monkeying with it for a bit, and I created a .conf file for pi-mqtt-gpio under /etc/supervisor/conf.d/:

[program:mqtt]
command=/usr/bin/python -m pi_mqtt_gpio.server /home/pi/pi-mqtt-gpio-config.yml
autostart=true
autorestart=true
stderr_logfile=/var/log/mqtt-stderr.log
stderr_logfile_maxbytes = 10MB
stderr_logfile_backups = 5
stdout_logfile=/var/log/mqtt-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5

However, when I try to run your program using supervisord it fails and I see the following in the stderr log:

$ cat /var/log/mqtt-stderr.log
/usr/bin/python: No module named pi_mqtt_gpio
/usr/bin/python: No module named pi_mqtt_gpio
/usr/bin/python: No module named pi_mqtt_gpio
/usr/bin/python: No module named pi_mqtt_gpio

I feel like I'm missing the full path for pi_mqtt_gpio.server but not sure?

Your program works fine when I run it directly from the command line using /usr/bin/python -m pi_mqtt_gpio.server /home/pi/pi-mqtt-gpio-config.yml

Can you post your .conf file for supervisord?

from mqtt-io.

steubens avatar steubens commented on May 27, 2024

@flyte I followed your new readme.md supervisor instructions and it worked like a charm. Many thanks!!!

from mqtt-io.

flyte avatar flyte commented on May 27, 2024

Excellent! :)

from mqtt-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.