Hello
I'm running Kamailio version: 4.2.5 (x86_64/linux). kamcmd is always exiting with exit status "0" even if the command failed.
root@lb:~# kamcmd willfail error: 500 - command willfail not found root@lb:~# echo $? 0
[live] root@lb32:~# kamcmd permissions.trustedReload Reload OK root@lb:~# echo $? 0
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/211
I think it is a relative point of view to be considered.
kamcmd itself didn't fail, because it is a tool to take the command line parameters and send a command to kamailio. Then it prints the output from kamailio. In that respect, kamcmd was successful.
I just tested with **curl** tool and if I request a page that doesn't exits on a web site, its return code is also 0.
Making kamcmd aware of the meaning of the response from kamailio might add complexity and duplicate lot of context, which can become hard to maintain.
I let the discussion here open for other opinions, to see what would be preferred to be done. I consider to be normal behaviour right now.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/211#issuecomment-112401755
I agree with you, my only concern is related to the fact that scripting kamcmd (on puppet for example), will end up in the case where you won't know if the command was successful or not.
A solution would be to use the stdout, and do some logic on top of that.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/211#issuecomment-112414241
You can use jsonrpc or xmlrpc for more standard formatted output. It should be easier to parse the result returned by kamailio.
Look at kamcli (https://github.com/asipto/kamcli) -- it can send jsonrpc commands via a local fifo file, if you prefer to avoid network communication.
I will close this as not being an issue. Eventually you can start a discussion on sr-dev mailing list for enhancing kamcmd in being more flexible in such situations.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/211#issuecomment-113508510
Closed #211.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/211#event-335215833