API command for running abitrary shell commands as the user - CMD_API_EXEC

Version 1.27.3

Feature
Finished

An API command allowing api developers to execute shell command as the user through DA. The default for this will be off, so if you need it, it will have to be turned on in the directadmin.conf The option for your directadmin.conf is: allow_user_exec=1 the default is 0 (if it's not there) CMD_API_EXEC method: POST command=/path/to/program options=your --list=of "options" Command must be a simple filename, don't include options in the command, just the command filename, that's it. The options will be placed after the command. Command must be the full path from top level /. No local commands allowed. 2>&1 will be added to the end of the command to catch the stderr output to stdin. Output from DA on a successfull run: error=0&exit=12345&result=outputtext if error=1, then there was a problem, message wil be set in "text". exit=1234 is the result number of the exec function. It's controlled by the return value of your script (although, in testing the number returned isn't exactly the same as the number the script exited with.. but it does change as the number in the script changes.. not sure why that is atm) result=outputtext is the usual url encoded text that your script produces. Note that there is a timeout (set in the Admin Settings). DA will kill the program with SIGTERM if it runs out of time. Also, do not run any script/programs that require stdin unless you pipe it from a file with <.

Try DirectAdmin with a 30-day money back guarantee!