aboutsummaryrefslogtreecommitdiff
path: root/.app/lib/pid-method
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-12 23:23:10 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-12 23:23:10 +0200
commitcdfcae52a49118d43e2064dd228b789b8452664f (patch)
tree62ee1d5f74adf0d085e9421b7a17ab3162dfde96 /.app/lib/pid-method
parent33ac32f2351b688300e656dfca3f7f6d69e56949 (diff)
downloadapp.sh-cdfcae52a49118d43e2064dd228b789b8452664f.tar.gz
app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.tar.bz2
app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.tar.xz
app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.zip
Major refactoring. Splitting out the method groups into separate files.
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