Showing results for 
Show  only  | Search instead for 
Did you mean: 

START_APP_CMD for Tomcat on Linux App Service



I've been trying to setup OA on a simple Tomcat process with. I have a Linux App service configured for Apache Tomcat 8.5 with Java 8, and I have created a startup scrip based on the documentation


I put this script in /home/ and declared it on the Startup Command field in Web App Settings. I also configured the DT_ variables in the App Settings.


From what I've seen on the raw script, it seems that after the LD_PRELOAD it expects to run something:

# Inject variable into the proccess and run the actual application proccess LD_PRELOAD="/opt/dynatrace/oneagent/agent/lib64/" $START_APP_CMD

So, what is the command I need to put there in order for the OA to inject on the Tomcat process?





Also, here is the log since I can't seem to make it work in 1 message:

2024-04-25T09:30:38.811521134Z STARTUP_COMMAND=
2024-04-25T09:30:38.813521392Z Copying /home/ to /tmp/ and fixing EOL characters in /tmp/
2024-04-25T09:30:38.834581906Z Running STARTUP_FILE: /tmp/
2024-04-25T09:30:38.948488027Z + readonly 'LIB_MUSL=musl'
2024-04-25T09:30:38.956471860Z + readonly 'LIB_GCLIB=libc'
2024-04-25T09:30:38.957476289Z + readonly 'LIB_DEFAULT=default'
2024-04-25T09:30:38.957489789Z + readonly 'ALPINE_RELEASE_FILE=/etc/alpine-release'
2024-04-25T09:30:38.957495590Z + readonly 'INSTALLER_DOWNLOAD_PATH=/tmp/'
2024-04-25T09:30:38.957500590Z + readonly 'INSTALLER_URL_SUFFIX=api/v1/deployment/installer/agent/unix/paas-sh/latest'
2024-04-25T09:30:38.957899501Z + main
2024-04-25T09:30:38.958134608Z + lib=
2024-04-25T09:30:38.958374715Z + check_ldd
2024-04-25T09:30:38.959259841Z + ldd /bin/echo
2024-04-25T09:30:38.976444842Z + ldd_result=' /lib/ (0x7e11e2275000)
2024-04-25T09:30:38.978284196Z => /lib/ (0x7e11e2275000)'
2024-04-25T09:30:38.979618635Z + readonly ldd_result
2024-04-25T09:30:38.988081481Z + grep -qi musl
2024-04-25T09:30:38.998547586Z + echo ' /lib/ (0x7e11e2275000)
2024-04-25T09:30:38.999750121Z => /lib/ (0x7e11e2275000)'
2024-04-25T09:30:39.007408745Z + lib=musl
2024-04-25T09:30:39.008726683Z + test -z musl
2024-04-25T09:30:39.015904292Z + test -z musl
2024-04-25T09:30:39.019697803Z + DT_FLAVOR=musl
2024-04-25T09:30:39.019720504Z + run
2024-04-25T09:30:39.019726604Z + wget -O /tmp/ -q 'https://{environmentid}'
2024-04-25T09:30:50.824393846Z + sh /tmp/
2024-04-25T09:30:50.851764421Z 09:30:50 Installing to /opt
2024-04-25T09:30:50.893107091Z 09:30:50 Extracting...
2024-04-25T09:30:53.829458527Z 09:30:53 Unpacking to '/opt/dynatrace/oneagent' ...
2024-04-25T09:31:14.980992878Z 09:31:14 Unpacking complete.
2024-04-25T09:31:15.042335979Z + LD_PRELOAD=/opt/dynatrace/oneagent/agent/lib64/
2024-04-25T09:31:15.050484818Z Finished running startup file '/tmp/'. Exit code: '0'.
2024-04-25T09:31:15.051052835Z No STARTUP_COMMAND defined.
2024-04-25T09:31:15.051712854Z Starting Tomcat with CATALINA_BASE set to ""
2024-04-25T09:31:15.052701283Z Launched child process with pid: 209
2024-04-25T09:31:15.060163903Z Waiting for main process to exit. GLOBAL_PID_MAIN=209
2024-04-25T09:31:15.060765220Z Waiting for GLOBAL_PID_MAIN == 209
2024-04-25T09:31:15.146008823Z Picked up JAVA_TOOL_OPTIONS: -Xmx1150M


Hello George, by looking at the log entries it seems that what is missing is the actual Start up command for your Tomcat Java application. It should point to the location and name of the startup that you normally use to start, it can even be the Environment variable in which you already store this script in the app service settings. 

Normally I configure all this inside the Azure portal App Service Configuration section, where it says Startup command:

You can add something like this, you need to replace all variables directly here or by declaring them before in the app service configuration


Best regards,




 This is the section I'm talking about.

Hi Jose,

Yes, that's the script I'm trying to figure out what to put in. In the past I have used pm2 or java there for Node and Java stack, but for Tomcat I don't get what I need to input there. Based on the MS documentation( it seems to expect a Tomcat configuration file but not necessarily a startup command. From this blog post( I gathered that you can use the tomcat startup script to make changes to the server, but I didn't see any startup command there like ./ etc.


START_APP_CMD= /usr/local/tomcat/bin/

I manage to get the OA to monitor the tomcat process.

Great! I was about to suggest the same.

If you don't see the traces yet you may need to restart again (double restart).

Good luck!

Featured Posts