#26: startProjectForge.sh

doc/misc/startProjectForge.sh

Path: site/uploads/startProjectForge.sh · Lines: 22 · Shebang: #!/bin/bash

Purpose: Production startup script — detects Java installation across platforms (Cygwin/Linux/macOS), allocates 4GB heap, launches ProjectForge as a nohup background daemon with all output redirected to /dev/null.

Source: GitHub

22 lines · 15 code · 1 comments · 6 blank
CommitMessage
ac75fabf3Github pages migrated to Asciidoc
Syntax error on line 3: Missing opening double-quote — PF_JAR=${HOME}/application/...". The correct line should be PF_JAR="${HOME}/application/projectforge-application-xxx.jar". The script as-is will fail to parse.

Three-tier Java detection

if [ "${OSTYPE}" == 'cygwin' ]; then
  JAVA=`cygpath "${JAVA_HOME}"`/jre/bin/java     # Windows via Cygwin
else
  if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
    JAVA="$JAVA_HOME/bin/java"                      # Linux/macOS with JAVA_HOME
  else
    JAVA=/usr/bin/java                              # Fallback: system Java
  fi
fi

Tier 1 — Cygwin: Converts Windows path (C:\Program Files\Java\jdk17) to Unix-style (/cygdrive/c/Program Files/Java/jdk17) using cygpath.

Tier 2 — JAVA_HOME: Checks that $JAVA_HOME/bin/java exists AND is executable (-x). Both conditions must pass.

Tier 3 — System default: /usr/bin/java — works on most Linux distributions but may be an older version or a stub that redirects to alternatives.

The launch command — line 22

nohup ${JAVA} -Xms4g -Xmx4g ${DEBUGOPTS} -jar $PF_JAR 2>&1 > /dev/null &
ComponentEffect
nohupIgnores SIGHUP — process survives terminal logout
-Xms4g -Xmx4g4GB heap, min=max. Avoids GC pauses from heap resizing. Appropriate for production, overkill for development.
${DEBUGOPTS}Empty by default (line 20). Change to -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 for remote debugging.
2>&1 > /dev/nullRedirects stderr→stdout, then stdout→/dev/null. ALL console output discarded. ProjectForge logs to ~/ProjectForge/logs/ProjectForge.log via Logback — not affected.
&Background — script returns immediately, doesn't wait for startup.

Key takeaways