aboutsummaryrefslogtreecommitdiff
path: root/.app/lib/pid-method
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-18 13:38:58 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-18 13:38:58 +0200
commit83c13f1181c4062ca5296ea956e950064bde0ffe (patch)
treeea021190acabc6e675510e13987cd4addbf50765 /.app/lib/pid-method
parent993c9a7807e38b365f48334fff6640e07647af03 (diff)
downloadapp.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.gz
app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.bz2
app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.tar.xz
app.sh-83c13f1181c4062ca5296ea956e950064bde0ffe.zip
o Making all scripts be run from the root/ directory. Do not assume you're in current/.
Diffstat (limited to '.app/lib/pid-method')
-rwxr-xr-x.app/lib/pid-method14
1 files changed, 8 insertions, 6 deletions
diff --git a/.app/lib/pid-method b/.app/lib/pid-method
index 55d74b8..29f6b4f 100755
--- a/.app/lib/pid-method
+++ b/.app/lib/pid-method
@@ -2,12 +2,13 @@
set -u
-PID_FILE=$APPSH_APPS/.app/var/pid/$APPSH_NAME-$APPSH_INSTANCE.pid
-
. $APPSH_HOME/.app/lib/app-conf
+pid_file=$APPSH_APPS/.app/var/pid/$APPSH_NAME-$APPSH_INSTANCE.pid
bin=`get_conf $APPSH_APPS $APPSH_NAME $APPSH_INSTANCE app.bin`
+cd $APPSH_APPS/$APPSH_NAME/$APPSH_INSTANCE/current
+
if [ -z "$bin" ]
then
echo "Missing required configuration: app.bin." >&2
@@ -23,9 +24,9 @@ fi
chmod +x "$bin"
PID=
-if [ -r $PID_FILE ]
+if [ -r $pid_file ]
then
- PID="`cat $PID_FILE`"
+ PID="`cat $pid_file`"
fi
do_status() {
@@ -51,9 +52,10 @@ method_start() {
esac
$bin <&- 1<&- 2<&- &
+
PID=$!
echo "Application launched as $PID"
- echo $PID > $PID_FILE
+ echo $PID > $pid_file
return 0
}
@@ -83,7 +85,7 @@ method_stop() {
done
echo " OK"
- rm -f $PID_FILE
+ rm -f $pid_file
return 0
}