aboutsummaryrefslogtreecommitdiff
path: root/.app/lib/pid-method
diff options
context:
space:
mode:
Diffstat (limited to '.app/lib/pid-method')
-rwxr-xr-x.app/lib/pid-method37
1 files changed, 37 insertions, 0 deletions
diff --git a/.app/lib/pid-method b/.app/lib/pid-method
new file mode 100755
index 0000000..e718849
--- /dev/null
+++ b/.app/lib/pid-method
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -e
+
+PID_FILE=$APPSH_BASEDIR/.app/var/pid/$name-$instance.pid
+
+. $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=$?
+ pid=$!
+ echo "Application launched with PID=$pid"
+ echo $pid > $PID_FILE
+ ;;
+ *)
+ exit 1
+ ;;
+esac