5242 questions

6398 answers

10282 comments

6367 members

0 votes
114 views 3 comments
by

According to the latest release notes, TRB14x now supports installation of packages (using opkg).

Given that running a python scrip / application is probably the most common use case (see here), could you please provide the basic steps to install python as well as the dependency paho-mqtt?

1 Answer

0 votes
by

Hello,

To install python using OpenWRT, use these commands when you are logged in to your router via SSH client or CLI: 

opkg update

opkg install python-light

More about Python package and installation: https://openwrt.org/docs/guide-user/services/python

If paho-mqtt dependency is OpenWRT supported, it should be installed the same way as python. Please refer to OpenWRT forums to find correct packages for your use cases.

Regards.

by
A follow-up question: what's the best way to run a long-running python script on the router? I currently start the script with `python script.py&` to run it in the background.

- the script should start on system start and restart if it fails.

- how does the logging work? where can I find the logs for the script?
by

I believe I found a good solution:

edit crontab (on the CLI, run `crontab -e`):

* * * * * flock -n /root/send.lockfile python /root/send.py

Basically, this should start and restart the script whenever it does not run.

by
I just noticed that after a firmware upgrade, all my files as well as the python installation are gone.Is there a way to make the python installation as well as the files I placed on the router permanent?