Is it possible to call a bash shell script using supervisord?

0

Issue

I’m trying to call this shell script using supervisord. supervisorctl reports the following error when trying to start the process:

kerby-kdc FATAL Exited too quickly
(process log may have details)

I checked the kerby logs but no errors were reported.

I configured the process in /etc/supervisor/supervisord.conf as follows:

[program:kerby-kdc]
command=bash -c "/home/test/kerberos/server/kdc-dist/bin/start-kdc.sh" /home/test/kerberos/server/kdc-dist/conf /home/test/kerberos/server/kdc-dist/runtime
user=test
environment=JAVA_HOME="/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin"
autostart=true
autorestart=true
startsecs=10
startretries=3

Is there something wrong with this configuration?

Solution

The shell script referenced in the OP contains the following:

java $DEBUG \
-classpath target/lib/*:. \
-DKERBY_LOGFILE=kdc \
org.apache.kerby.kerberos.kdc.KerbyKdcServer -start $args

Note that the classpath is relative. When supervisord tries to execute the java command, the JVM will be unable to find the class org.apache.kerby.kerberos.kdc.KerbyKdcServer. That’s because target/lib doesn’t exist relative to the supervisord execution path.

The classpath needs to be absolute or a CLASSPATH environment variable needs to be added to the supervisord.conf file.

Answered By – James

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More