12.02.2018, 08:15 (This post was last modified: 12.02.2018, 10:32 by Hippolyte.)
Hi everyone,
A lot of questions lately but this one may be tricky.
We have to update a script on 300 LMs, please tell me there is a simple way to do this remotely … The script name is the same on every LM.
I know there is no API for this but maybe you have another technical solution in your head !
Thank you very much for your help.
You can create a custom .lp file that will handle this, to which you must pass name and script get/post variables. Like this: http://LM_IP/user/update.lp?name=test&script=log(event)
For better security you should add some extra password/variable check to this file.
Code:
12345678910111213141516171819202122232425
<?
name = getvar('name')
scriptdata = getvar('script')
ifnameandscriptdatathenitem = script.get(name)
ifitemthenitem.script = scriptdatadb:update('scripting', { script = scriptdata }, { id = item.id })
-- save script data to filescript.save(item, true)
-- reload script/group monitorscript.reloadsingle(item)
print('update ok')
elseprint('script not found')
endelseprint('invalid arguments')
end
(21.03.2018, 17:14)admin Wrote: You probably have a non breaking space there, either use another code editor or remove all leading spaces from the code.
Whether I put it perfectly like this
Code:
1234567891011121314151617181920
<?
require('apps')
name = getvar('name')
scriptdata = getvar('script')
ifnameandscriptdatathenitem = script.get(name)
ifitemthenitem.script = scriptdatadb:update('scripting', { script = scriptdata }, { id = item.id })
script.save(item, true)
reloadscript/groupmonitorscript.reloadsingle(item)
print('update ok')
elseprint('script not found')
endelseprint('invalid arguments')
end
?>
Or this
Code:
1234567891011121314151617181920
<?
require('apps')
name = getvar('name')
scriptdata = getvar('script')
ifnameandscriptdatathenitem = script.get(name)
ifitemthenitem.script = scriptdatadb:update('scripting', { script = scriptdata }, { id = item.id })
script.save(item, true)
reloadscript/groupmonitorscript.reloadsingle(item)
print('update ok')
elseprint('script not found')
endelseprint('invalid arguments')
end
?>
Hello, once again thank you for your help.
So it is working really great. Yet I still have this return carriage issue. If I use the http://LM_IP/user/update.lp?name=test&sc...inesscript then the script is written on only one line when I open it on the LM, do you think there is a way to keep the indentation ?
This is for upgrading script on 500 LMs at the same time