@hnyman you were right! The execution environment is set up differently. Executing from the terminal window the $PATH variable resolves to /usr/sbin:/usr/bin:/sbin:/bin. Executing from the custom commands page of the webinterface the $PATH variable is different: /sbin:/usr/sbin:/bin:/usr/bin.
Why is this set up differently?