FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,933 views 4 comments
by anonymous

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 anonymous

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 anonymous
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 anonymous

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 anonymous
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?
by anonymous

I tried this step but when I run:

opkg update

I get the following errors:

 * opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02.0/targets/mdm9x07/generic/packages/Packages.gz, wget returned 8.
 * opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02.0/packages/arm_cortex-a7_neon-vfpv4/vuci/Packages.gz, wget returned 8.

Any idea what this is about? I have the newest firmware (TRB1_R_00.07.01.4) and internet connection is working in general.