Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7503

General discussion • Re: MQTT Publishing Cron Job Stopping Randomly

$
0
0
For background processes you could use 'logging' module to track your code.
https://docs.python.org/3/library/logging.html
Have a look to RotatingFileHandler, which prevents the log files to grow indefinitely.
https://docs.python.org/3/library/loggi ... ileHandler

When starting process with systemd, the 'print' output to stdout is recorded by systemd and can be read with 'journalctl'.

MQTT (python, paho) is a perfect choice for long running applications. Have an application running here for years (ok, a bit exaggerated: I restarted it 166 days ago) on a RPi powered from an UPS.
One of my other MQTT systems had problems with repeated stops; problem was a memory overflow in some parts of the user code. In this case there was a tkinter canvas involved for a dashboard; the canvas elements were not tidied up and therefore accumulated.

Statistics: Posted by ghp — Thu May 08, 2025 4:16 am



Viewing all articles
Browse latest Browse all 7503

Trending Articles