I have two files, an env file and a run file. When I deploy them to my Ubuntu Server box I get the error:
./start-admin: line 10: syntax error: unexpected end of file
If I deploy and then add a newline to the end of the file, it will show the error. If I then remove it the error goes away. If I deploy again and don't add the newline, it still shows the error, but if I then add a newline the error goes away. What could possibly cause that?
Below are my scripts:
env:
if [ "x${WD}" == "x" ]; then echo "missing required conf \"\${WD}\"" >&2; exit -1; fi
export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
export JAR_FILE="$WD/mfa-admin.jar"
export MYSQL_URL=url1
export MYSQL_USER=root
export MYSQL_PASSWORD=pwd
export DB_URL=url2
export DB_USER=user
export DB_PASSWORD=pwd2
export EMAIL_HOST=mail-inbox
export EMAIL_PORT=25
export EMAIL_PERMISSION=false
export FAKE_EMAIL=email
export ACTIVATION_URL=url
export BIND_HOST=0.0.0.0
export BIND_PORT=8282
start:
WD=`dirname $0`;
JAVA_OPTS=""
if [ -r "$WD/admin.env.conf" ]; then
. $WD/admin.env.conf
fi
# required stuff
if [ "x${JAVA_HOME}" == "x" ]; then echo "missing required conf \"\${JAVA_HOME}\"" >&2; exit -1; fi
if [ "x${JAR_FILE}" == "x" ]; then echo "missing required conf \"\${JAR_FILE}\"" >&2; exit -1; fi
if [ "x${MYSQL_URL}" == "x" ]; then echo "missing required conf \"\${MYSQL_URL}\"" >&2; exit -1; fi
if [ "x${MYSQL_USER}" == "x" ]; then echo "missing required conf \"\${MYSQL_USER}\"" >&2; exit -1; fi
if [ "x${MYSQL_PASSWORD}" == "x" ]; then echo "missing required conf \"\${MYSQL_PASSWORD}\"" >&2; exit -1; fi
if [ "x${DB_URL}" == "x" ]; then echo "missing required conf \"\${DB_URL}\"" >&2; exit -1; fi
if [ "x${DB_USER}" == "x" ]; then echo "missing required conf \"\${DB_USER}\"" >&2; exit -1; fi
if [ "x${DB_PASSWORD}" == "x" ]; then echo "missing required conf \"\${DB_PASSWORD}\"" >&2; exit -1; fi
if [ "x${EMAIL_HOST}" == "x" ]; then echo "missing required conf \"\${EMAIL_HOST}\"" >&2; exit -1; fi
if [ "x${EMAIL_PORT}" == "x" ]; then echo "missing required conf \"\${EMAIL_PORT}\"" >&2; exit -1; fi
if [ "x${EMAIL_PERMISSION}" == "x" ]; then echo "missing required conf \"\${EMAIL_PERMISSION}\"" >&2; exit -1; fi
if [ "x${FAKE_EMAIL}" == "x" ]; then echo "missing required conf \"\${FAKE_EMAIL}\"" >&2; exit -1; fi
if [ "x${ACTIVATION_URL}" == "x" ]; then echo "missing required conf \"\${ACTIVATION_URL}\"" >&2; exit -1; fi
if [ "x${BIND_HOST}" == "x" ]; then echo "missing required conf \"\${BIND_HOST}\"" >&2; exit -1; fi
if [ "x${BIND_PORT}" == "x" ]; then echo "missing required conf \"\${BIND_PORT}\"" >&2; exit -1; fi
JAVA_OPTS="${JAVA_OPTS} -Dmysql.URL=\"${MYSQL_URL}\" "
JAVA_OPTS="${JAVA_OPTS} -Dmysql.USER=\"${MYSQL_USER}\" "
JAVA_OPTS="${JAVA_OPTS} -Dmysql.PASSWORD=\"${MYSQL_PASSWORD}\" "
JAVA_OPTS="${JAVA_OPTS} -Ddb.URL=\"${DB_URL}\" "
JAVA_OPTS="${JAVA_OPTS} -Ddb.USER=\"${DB_USER}\" "
JAVA_OPTS="${JAVA_OPTS} -Ddb.PASSWORD=\"${DB_PASSWORD}\" "
JAVA_OPTS="${JAVA_OPTS} -DEMAIL_HOST=\"${EMAIL_HOST}\" "
JAVA_OPTS="${JAVA_OPTS} -DEMAIL_PORT=\"${EMAIL_PORT}\" "
JAVA_OPTS="${JAVA_OPTS} -DEMAIL_PERMISSION=\"${EMAIL_PERMISSION}\" "
JAVA_OPTS="${JAVA_OPTS} -DFAKE_EMAIL=\"${FAKE_EMAIL}\" "
JAVA_OPTS="${JAVA_OPTS} -DACTIVATION_URL=\"${ACTIVATION_URL}\" "
JAVA_OPTS="${JAVA_OPTS} -DBIND_HOST=\"${BIND_HOST}\" "
JAVA_OPTS="${JAVA_OPTS} -DBIND_PORT=\"${BIND_PORT}\" "
JAVA="$JAVA_HOME/bin/java"
eval \"$JAVA\" $JAVA_OPTS -cp "${WD}:${JAR_FILE}" VertxNode
dos2unix– Serge Feb 27 at 16:36#!/bin/bash. Otherwise they will be executed with/bin/shand not bash. You could make your scripts compatible with/bin/shby using[ "x${foo}" = x ]instead of==, that's the only bash extension that you use. You would still need to start the script with#!/bin/sh. – Gilles Feb 27 at 23:16bash -x start-adminthen post debug output. – Rahul Patil Feb 28 at 1:49