I have a .sh script that starts a java service of mine (I didn't write this).
Can someone explain how this actually executes?
start() {
..
..
# setup classpath
. $ROOT/bin/_cp.sh
RUN="java -Dlog.root=$VAR $JOPTS $CP $MAIN -v"
# start
$RUN 2>>$OUT_FILE >>$OUT_FILE &
}
When start gets called, it builds sets the variables for the options and class path (java stuff), but when does this line do?
$RUN 2>>$OUT_FILE >>$OUT_FILE &
Is $RUN something built in at all?
I want to convert this over to a upstart script, and upstart requires me to use exec like:
script
[ "$enabled" = "1" ] || [ "$force_start" = "1" ] || exit 0
# Setup Serviio specific properties
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME -Xmx512M -Xms20M -XX:+UseParNewGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20"
# construct classpath
cd $SERVIIO_HOME
CLASSPATH="config"
for i in lib/*.jar; do
CLASSPATH="$CLASSPATH:$i"
done
# write to syslog - for debugging
# logger -t $0 -- "starting: /usr/bin/java $JAVA_OPTS -classpath $CLASSPATH org.serviio.MediaServer"
exec /usr/bin/java $JAVA_OPTS -classpath $CLASSPATH org.serviio.MediaServer
end script
RUN="java -Dlog.root=$VAR $JOPTS $CP $MAIN -v"creates a bash variableRUN. I think$RUN 2>>$OUT_FILE >>$OUT_FILE &prints the contents ofRUNinto two files. – Seth Feb 19 at 4:12