Cumulocity lua script

Does anybody successfully run the cumulocity lua script

WikI 1st is wrong on current version luci.util and luci.sys doesn’t exist their are vuci. now

As wiki claim

Custom lua scripts can be placed in „/usr/local/usr/lib/lua/cm/“. Application will scan this folder for any *.lua files and load them if they contains „init“ function.

but simple 3 row script

function init()
os.execute(“echo inittest-script-init >> /tmp/cm_test.log”)
end

aproove that init() is never run

Any ideas?

Regards

Greetings,

Welcome to the Teltonika Community!

Could you please provide the following details:

  • Device model
  • Firmware version currently in use
  • The Wiki article where the issue was noticed

This information will help with further investigation.

Kind regards,
V.

Hi,

RUT200 RUT2M_R_00.07.19.4

Regards

Hello,

Could you please confirm that the cumulocity package is installed in the router from the package manager? If not, you can navigate to System → Package manager to install it.
The /usr/local/usr/lib/lua/cm/ directory is created during package installation.

I look forward to your reply.

Best regards,
V.

Cumulocity package is installed and router successfully connected to Cumulocity and send router telemetry to Cumulocity

/usr/local/usr/lib/lua/cm/ exist and has template file with content described in wiki

but when i create the lua script file with init() function, its doesn’t find it and init() is never executed

I tried the example from wiki and finaly simple script witch just write the message to file

To avoid the syntax error in script when i run script manually with explicity calling the init() function, the script is working

Regards

Juri