tomcat9genexus

Genexus Shell function is not working on Ubuntu 20.04/Tomcat9/Java11 to execute a shell script (.sh)


I need to execute a bash script (.sh) from a web application developed with Genexus X EV3 generating code for Tomcat9/Ubuntu 20.04/Java11 RE using the shell function. The script for example purposes here is not a big deal:

#!/bin/bash
mkdir DirTest

The way to execute it from Genexus is this:

&path = '/home/adminap/tomcat9/webapps/proto01/test.sh'
&execute = shell(&path,1)

However when I execute the previous code, within a Genexus procedure, it doesn't run and shell function returns 1, which means it was not executed. I don't think this is about permissions on .sh file (it has chmod 777) because when I execute the script from a bash terminal (Ubuntu 20.04) with Tomcat's user, it works fine. In addition when I use the same code as the previous paragraph's code with another Genexus model generating for Tomcat7/Ubuntu14/Java8 it works fine, I mean, the Genexus shell function is working fine with Tomcat7 but not with Tomcat9. Is the same generator and the same KB and the only difference is the environment it is generated to.

Thanks in advance for your assistance.


Solution

  • It seems a problem related with the "tomcat sandboxed by systemd" which is explained here.

    Ubuntu is a Debian-based distribution so, this would applies.