Okay, people were very kind in pointing me to how to find our which Java version is running by looking at the /usr/local/etc/javavms file here LINK. Now I have another question.
I have been working on an rc.d script that will manage a Java application here LINK. I now have that running. My questions is this.
Is there a way to use the output of /usr/local/etc/javavms in my rc.d script?
I am stuck trying to use the values from /usr/local/etc/javavms in the
Why are you wanting to do this?, you might ask. Well, when I used /usr/local/bin/java in the
However, when I used /usr/local/openjdk8/jre/bin/java, my application would show status correctly...
Any ideas? It would be really nice to not have to hard-code the value in my rc.d script...
I have been working on an rc.d script that will manage a Java application here LINK. I now have that running. My questions is this.
Is there a way to use the output of /usr/local/etc/javavms in my rc.d script?
Code:
# $FreeBSD$
#
# PROVIDE: foobar
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable foobar by using
# sysrc or by editing the file directly.
#
# foobar="YES"
#
# This script takes one of the following commands:
#
# start stop restart status
#
. /etc/rc.subr
: ${foobar_enable:="NO"}
: ${foobar_user="root"}
: ${foobar_args="-Xms512M -Xmx512M -classpath '/usr/local/apps/foobar.jar' com.foobar.Service"}
name=foobar
procname="/usr/local/openjdk8/jre/bin/java"
desc="Foobar Service"
rcvar="${name}_enable"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
stop_postcmd="echo Bye-bye"
command_args="-t ${name} -T ${name} -u ${foobar_user} -S -p ${pidfile} ${procname} ${foobar_args}"
load_rc_config "${name}"
run_rc_command "$1"
I am stuck trying to use the values from /usr/local/etc/javavms in the
procname
. Why are you wanting to do this?, you might ask. Well, when I used /usr/local/bin/java in the
procname
, my application would not show status correctly...
Bash:
root@localhost:/usr/local/etc/rc.d # service foobar status
foobar is not running.
root@localhost:/usr/local/etc/rc.d #
However, when I used /usr/local/openjdk8/jre/bin/java, my application would show status correctly...
Bash:
root@localhost:/usr/local/etc/rc.d # service foobar status
foobar is running as pid 24360.
root@localhost:/usr/local/etc/rc.d #
Any ideas? It would be really nice to not have to hard-code the value in my rc.d script...