summaryrefslogtreecommitdiff
path: root/.app/lib/default-method
diff options
context:
space:
mode:
Diffstat (limited to '.app/lib/default-method')
-rwxr-xr-x[-rw-r--r--].app/lib/default-method22
1 files changed, 20 insertions, 2 deletions
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