diff --git a/nanodb b/nanodb index ee19f567655a68c32a9fe64f3e19ec3c4eb59a77..4bcae5311e6bb108c85ecfddda696311d4ab3dd1 100755 --- a/nanodb +++ b/nanodb @@ -4,10 +4,20 @@ NANODB_SERVER_JAR=`ls target/nanodb-server-*.jar 2>/dev/null` if [ -z "$NANODB_SERVER_JAR" ] then - echo "Can't find NanoDB server JAR file. Run 'mvn package' to build the project." + 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: diff --git a/ndbc b/ndbc index 7d294c143f82f4d269f2a82111cd274a64a2b303..276ba61f71029e88908051a986c2ab4a882a3a25 100755 --- a/ndbc +++ b/ndbc @@ -4,10 +4,20 @@ NANODB_SERVER_JAR=`ls target/nanodb-server-*.jar 2>/dev/null` if [ -z "$NANODB_SERVER_JAR" ] then - echo "Can't find NanoDB server JAR file. Have you built the project?" + 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 + # To set the page-size to use, add "-Dnanodb.pagesize=2048" to JAVA_OPTS. # To enable transaction processing, add "-Dnanodb.txns=on" to JAVA_OPTS. JAVA_OPTS="-Dlog4j.configurationFile=log4j2.properties" diff --git a/ndbs b/ndbs index d078d2c60f339c153b1eb07a3b8c90bbc55b9695..f264f77891463d0ea2e2e2e17af50859f4ef02ac 100755 --- a/ndbs +++ b/ndbs @@ -4,10 +4,20 @@ NANODB_SERVER_JAR=`ls target/nanodb-server-*.jar 2>/dev/null` if [ -z "$NANODB_SERVER_JAR" ] then - echo "Can't find NanoDB server JAR file. Have you built the project?" + echo "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 + # To set the page-size to use, add "-Dnanodb.pagesize=2048" to JAVA_OPTS. # To enable transaction processing, add "-Dnanodb.txns=on" to JAVA_OPTS. JAVA_OPTS="-Dlog4j.configurationFile=log4j2.properties"