summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-10 13:06:24 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-10 13:06:24 +0200
commit3d6417834481deec5b3c39754c075471e6278225 (patch)
tree7e89f54f207533aa215ae455fcd06a048c8a5ebb
parent908dd2b72e4ab4caa0bc77405d5636b935e0878e (diff)
downloadapp.sh-3d6417834481deec5b3c39754c075471e6278225.tar.gz
app.sh-3d6417834481deec5b3c39754c075471e6278225.tar.bz2
app.sh-3d6417834481deec5b3c39754c075471e6278225.tar.xz
app.sh-3d6417834481deec5b3c39754c075471e6278225.zip
o Getting the default method to work again.
o Getting passing of environment variables to work again.
-rw-r--r--.app/lib/app-conf4
-rwxr-xr-x[-rw-r--r--].app/lib/default-method22
-rwxr-xr-xapp4
3 files changed, 24 insertions, 6 deletions
diff --git a/.app/lib/app-conf b/.app/lib/app-conf
index b1b06c0..3f2863b 100644
--- a/.app/lib/app-conf
+++ b/.app/lib/app-conf
@@ -44,10 +44,10 @@ get_conf_in_group() {
local BASEDIR=$1
local name=$2
local instance=$3
- local prefix=$1
+ local group=$4
get_conf_all "$BASEDIR" "$name" "$instance" | \
- sed -n "s,^[ ]*${prefix}\.\([._a-zA-Z]*\)=\(.*\)$,\1=\2,p"
+ sed -n "s,^[ ]*${group}\.\([._a-zA-Z]*\)=\(.*\)$,\1=\2,p"
}
assert_key() {
diff --git a/.app/lib/default-method b/.app/lib/default-method
index 2313f61..e718849 100644..100755
--- a/.app/lib/default-method
+++ b/.app/lib/default-method
@@ -1,17 +1,35 @@
#!/bin/bash
+set -e
+
PID_FILE=$APPSH_BASEDIR/.app/var/pid/$name-$instance.pid
-. ./app-conf
+. $APPSH_BASEDIR/.app/lib/app-conf
bin=`get_conf $APPSH_BASEDIR $APPSH_NAME $APPSH_INSTANCE app.bin`
+if [ -z "$bin" ]
+then
+ echo "Missing required configuration: app.bin." >&2
+ exit 1
+fi
+
+if [ ! -r "$bin" ]
+then
+ echo "No such file: $bin" >&2
+ exit 1
+fi
+
+chmod +x "$bin"
+
case "$APPSH_METHOD" in
start)
set -x
$bin &
ret=$?
- echo $! > $PID_FILE
+ pid=$!
+ echo "Application launched with PID=$pid"
+ echo $pid > $PID_FILE
;;
*)
exit 1
diff --git a/app b/app
index b78d71b..e122453 100755
--- a/app
+++ b/app
@@ -321,10 +321,10 @@ run_method() {
exit 1
fi
- e=`get_conf_in_group $BASEDIR $name $instance env`
+ set -x
+ e="`get_conf_in_group $BASEDIR $name $instance env`"
set +e
- set -x
env -i \
$e \
PATH=/bin:/usr/bin \