427368 - start.sh fails quietly on command line error

+ Correcting bad --daemon use
+ Adding start-log-file command line instead
+ Adding feedback about start-log-file use
This commit is contained in:
Joakim Erdfelt 2014-03-11 14:29:11 -07:00
parent b95e454f7d
commit 2afd16ec39
2 changed files with 5 additions and 2 deletions

View File

@ -399,7 +399,7 @@ case "$ACTION" in
CH_USER="-c$JETTY_USER" CH_USER="-c$JETTY_USER"
fi fi
start-stop-daemon -S -p"$JETTY_PID" $CH_USER -d"$JETTY_HOME" -b -m -a "$JAVA" -- "${RUN_ARGS[@]}" --daemon start-stop-daemon -S -p"$JETTY_PID" $CH_USER -d"$JETTY_HOME" -b -m -a "$JAVA" -- "${RUN_ARGS[@]}" start-log-file="$JETTY_LOGS/start.log"
else else
@ -421,7 +421,7 @@ case "$ACTION" in
chown "$JETTY_USER" "$JETTY_PID" chown "$JETTY_USER" "$JETTY_PID"
# FIXME: Broken solution: wordsplitting, pathname expansion, arbitrary command execution, etc. # FIXME: Broken solution: wordsplitting, pathname expansion, arbitrary command execution, etc.
su - "$JETTY_USER" -c " su - "$JETTY_USER" -c "
exec ${RUN_CMD[*]} --daemon & exec ${RUN_CMD[*]} start-log-file="$JETTY_LOGS/start.log" &
disown \$! disown \$!
echo \$! > '$JETTY_PID'" echo \$! > '$JETTY_PID'"
else else

View File

@ -140,6 +140,9 @@ public class StartLog
// Output about error is lost in majority of cases. // Output about error is lost in majority of cases.
throw new UsageException(UsageException.ERR_LOGGING,new IOException("Unable to write to: " + startLog.getAbsolutePath())); throw new UsageException(UsageException.ERR_LOGGING,new IOException("Unable to write to: " + startLog.getAbsolutePath()));
} }
System.out.println("Logging to " + logfile);
PrintStream logger = new PrintStream(new FileOutputStream(startLog,false)); PrintStream logger = new PrintStream(new FileOutputStream(startLog,false));
System.setOut(logger); System.setOut(logger);
System.setErr(logger); System.setErr(logger);