1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Look for the NanoDB server JAR file in the target directory
NANODB_SERVER_JAR=`ls target/nanodb-server-*.jar 2>/dev/null`
if [ -z "$NANODB_SERVER_JAR" ]
then
echo "ERROR: Can't find NanoDB server JAR file. Run 'mvn package' to build the project."
exit 1
fi
# Check if the sources are out of date and warn the user to rerun 'mvn package'.
{
SOURCE_LAST_MODIFIED="$(find src -type f -exec stat \{\} --printf='%Y\n' \; | sort -n -r | head -n 1)"
JAR_LAST_MODIFIED="$(stat $NANODB_SERVER_JAR --printf '%Y\n')"
if [ -n "$SOURCE_LAST_MODIFIED" -a "$SOURCE_LAST_MODIFIED" -gt "$JAR_LAST_MODIFIED" ]; then
echo "WARNING: Your jar file is out of date. Please re-run 'mvn package' to rebuild the project."
fi
} 2>/dev/null
JAVA_OPTS="-Dlog4j.configurationFile=log4j2.properties"
# Server properties can be specified as system-property arguments. Examples:
# - To change the default page-size to use, add "-Dnanodb.pagesize=2048"
# - To enable transaction processing, add "-Dnanodb.enableTransactions=on"
# JAVA_OPTS="$JAVA_OPTS -Dnanodb.enableTransactions=on"
# To enable connection to a running server via the IntelliJ IDEA debugger,
# uncomment this line:
# JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5009"
PLATFORM=`uname`
if [[ $PLATFORM == *"MINGW"* ]]; then
# Windows, probably git bash
WRAPPER=winpty
else
# See if we have the rlwrap utility; if so, it makes using NanoDB
# from the command-line sooo much nicer...
testrl=$(which rlwrap)
if [ -z "$testrl" ]; then
# No wrapper
WRAPPER=
else
WRAPPER=rlwrap
fi
fi
$WRAPPER java $JAVA_OPTS "$@" -jar $NANODB_SERVER_JAR