Update memcache.lua
This commit is contained in:
parent
14bb4e766f
commit
fa0ac3f46b
|
|
@ -66,7 +66,6 @@
|
||||||
local api_command_argument = event:getHeader("API-Command-Argument");
|
local api_command_argument = event:getHeader("API-Command-Argument");
|
||||||
if (api_command_argument ~= nil) then
|
if (api_command_argument ~= nil) then
|
||||||
api_command_argument = trim(api_command_argument);
|
api_command_argument = trim(api_command_argument);
|
||||||
api_command_argument = api_command_argument:gsub(" ", "%%20");
|
|
||||||
end
|
end
|
||||||
if (api_command_argument ~= nil) then
|
if (api_command_argument ~= nil) then
|
||||||
if (api_command_argument == "flush") then
|
if (api_command_argument == "flush") then
|
||||||
|
|
@ -78,11 +77,13 @@
|
||||||
if (memcache_updated) then
|
if (memcache_updated) then
|
||||||
for key,row in pairs(servers) do
|
for key,row in pairs(servers) do
|
||||||
if (row.method == "ssh") then
|
if (row.method == "ssh") then
|
||||||
|
api_command_argument = api_command_argument:gsub("%%20", " ");
|
||||||
cmd = [[ssh ]]..row.username..[[@]]..row.hostname..[[ "fs_cli -x 'memcache ]]..api_command_argument..[['"]];
|
cmd = [[ssh ]]..row.username..[[@]]..row.hostname..[[ "fs_cli -x 'memcache ]]..api_command_argument..[['"]];
|
||||||
freeswitch.consoleLog("INFO", "[notice] command: ".. cmd .. "\n");
|
freeswitch.consoleLog("INFO", "[notice] command: ".. cmd .. "\n");
|
||||||
os.execute(cmd);
|
os.execute(cmd);
|
||||||
end
|
end
|
||||||
if (row.method == "curl") then
|
if (row.method == "curl") then
|
||||||
|
api_command_argument = api_command_argument:gsub(" ", "%%20");
|
||||||
url = [[http://]]..row.username..[[:]]..row.password..[[@]]..row.hostname..[[:]]..row.port..[[/webapi/memcache?]]..api_command_argument;
|
url = [[http://]]..row.username..[[:]]..row.password..[[@]]..row.hostname..[[:]]..row.port..[[/webapi/memcache?]]..api_command_argument;
|
||||||
os.execute("curl "..url);
|
os.execute("curl "..url);
|
||||||
freeswitch.consoleLog("INFO", "[notice] curl ".. url .. " \n");
|
freeswitch.consoleLog("INFO", "[notice] curl ".. url .. " \n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue