This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Remote restore of user scripts
#1
Hi,

we want to update or initialize LM remotely via ssh/FTP. 

Our idea is to use restore scripts (user scripts) first and then we just use our implementation.

We will update restore file for user scripts via FTP and then execute LUA script via SSH (also updated) to remove all old user scripts and restore scripts from file

Question is: How we can restore user libraries via LUA script from unix command-line on LM? (if is possible from GUI it have to work also from script somehow)

Thank you for help.
Reply
#2
User libraries are plain files stored in /usr/share/lua/user/
Reply
#3
(20.03.2018, 14:33)admin Wrote: User libraries are plain files stored in /usr/share/lua/user/

Are these files encrypted in any way? I'm trying to read the files, but getting (in lack of better term) gibberish in response.
Reply
#4
.lua files are in byte-code form. If "Keep source" is enabled then .luas files with plain source code are kept there as well.
Reply
#5
(07.12.2018, 09:48)admin Wrote: .lua files are in byte-code form. If "Keep source" is enabled then .luas files with plain source code are kept there as well.

Gotcha! So if we were to update some of these libraries remotely, would there be a recommended process? The libraries in question are not ticked Keep Source (to protect ip), I'm guessing that would be a problem? Are the libraries linked to sql in any way?
Reply
#6
No, libraries are just Lua byte code files. If you don't want to share source then convert them locally on your LM first.
Reply
#7
We have a similar problem.
We are implementing a script that downloads an update of a user library (luas file) and then saves it in the /usr/share/lua/ user folder.
Two questions:
a) In order to be executed it must be converted into bytecode and in this case can it be done with a LM local command (e.g. with a script)?
b) After copying the new library, is it necessary to restart the LM?


Thanks
Reply
#8
Lua can load both plain source and byte code files so using byte code for user libraries is not mandatory.
You can convert source to byte code like this:
Code:
fn = loadfile(path_to_source)
bc = string.dump(fn, false)
io.writefile(path_to_bytecode, bc)

You need to restart any resident scripts that are using old libraries. All other scripts will use updated libraries automatically when run. Restarting LM is the easiest solution.
Reply
#9
thank you so much!
Reply


Forum Jump: