source: installer/resources/runplain.sh

Last change on this file was e614b099, checked in by zzz <zzz@…>, 4 years ago

Router: Fix low-memory log messages for non-wrapper (ticket #1795)
Install: Add max memory option to runplain.sh
Build: Fix minimum Java version for Windows

  • Property mode set to 100644
File size: 1.7 KB
Line 
1#!/bin/sh
2
3# This runs the router by itself, WITHOUT the wrapper.
4# This means the router will not restart if it crashes.
5# Also, you will be using the default memory size, which is
6# probably not enough for i2p, unless you set it below.
7# You should really use the i2prouter script instead.
8#
9
10# Paths
11# Note that (percent)INSTALL_PATH and (percent)SYSTEM_java_io_tmpdir
12# should have been replaced by the izpack installer.
13# If you did not run the installer, replace them with the appropriate path.
14I2P="%INSTALL_PATH"
15I2PTEMP="%SYSTEM_java_io_tmpdir"
16
17# Having IPv6 enabled can cause problems with certain configurations. Changing the
18# next value to true may help.
19PREFERv4="false"
20CP=
21
22# Uncomment to set the maximum memory. The default and the option may vary in different JVMs.
23# Check your java documentation to be sure.
24#MAXMEMOPT="-Xmx256m"
25
26# Try using the Java binary that I2P was installed with.
27# If it's not found, try looking in the system PATH.
28JAVA=$(which %JAVA_HOME/bin/java || which java)
29
30if [ -z $JAVA ] || [ ! -x $JAVA ]; then
31    echo "Error: Cannot find java." >&2
32    exit 1
33fi
34
35for jar in `ls ${I2P}/lib/*.jar`; do
36    if [ ! -z $CP ]; then
37        CP=${CP}:${jar};
38    else
39        CP=${jar}
40    fi
41done
42
43if [ $(uname -s) = "Darwin" ]; then
44    export JAVA_TOOL_OPTIONS="-Djava.awt.headless=true"
45fi
46JAVAOPTS="${MAXMEMOPT} -Djava.net.preferIPv4Stack=${PREFERv4} -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt"
47(
48    nohup ${JAVA} -cp \"${CP}\" ${JAVAOPTS} net.i2p.router.RouterLaunch > /dev/null 2>&1
49) &
50PID=$!
51
52if [ ! -z $PID ] && kill -0 $PID > /dev/null 2>&1 ; then
53    echo "I2P started [$PID]" >&2
54    echo $PID > "${I2PTEMP}/router.pid"
55else
56    echo "I2P failed to start." >&2
57    exit 1
58fi
Note: See TracBrowser for help on using the repository browser.