Logic Machine Forum
ftp init-script and reboot from url - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: ftp init-script and reboot from url (/showthread.php?tid=4195)



ftp init-script and reboot from url - JohnTH - 17.08.2022

Hi,

Is it possible to upload a init-script via ftp/sftp and reboot the LM5 from a url ?

We are using LM5 as site-controller on buildings with mqtts sub/pub to broker in AWS.
Ansible for automation tasks on servers, including fetching backups from LM's (http://<ip>/scada-main/general/backup)

Having a way to set IP parameters, init script and reboot would really help.

Any help is appreciated
Appreciat
-John
Appreciate any 


RE: ftp init-script and reboot from url - admin - 18.08.2022

You can use HTTP for this. See Apps documentation on how to create .lp server-side scripts: https://forum.logicmachine.net/showthread.php?tid=85
Code:
-- overwrite init script
io.writefile('/usr/share/lua/genohm-scada/initscript.lua', script)

-- set network config
require('uci')

uci.set('network', 'lan', 'ipaddr', '192.168.1.2')
uci.set('network', 'lan', 'netmask', '255.255.255.0')
uci.set('network', 'lan', 'gateway', '192.168.1.1')
uci.set('network', 'lan', 'dns', '8.8.8.8')

uci.commit('network')

-- reboot
os.execute('reboot')



RE: ftp init-script and reboot from url - JohnTH - 18.08.2022

(18.08.2022, 06:59)admin Wrote: You can use HTTP for this. See Apps documentation on how to create .lp server-side scripts: https://forum.logicmachine.net/showthread.php?tid=85
Code:
-- overwrite init script
io.writefile('/usr/share/lua/genohm-scada/initscript.lua', script)

-- set network config
require('uci')

uci.set('network', 'lan', 'ipaddr', '192.168.1.2')
uci.set('network', 'lan', 'netmask', '255.255.255.0')
uci.set('network', 'lan', 'gateway', '192.168.1.1')
uci.set('network', 'lan', 'dns', '8.8.8.8')

uci.commit('network')

-- reboot
os.execute('reboot')

Thanks admin!