summaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/post-receive27
1 files changed, 21 insertions, 6 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
index a2835de..e0375c3 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -23,9 +23,12 @@ IFS=$'\t'
csvtool -u TAB namedcol dir,resolver,resolver_args,version,state apps.csv | \
while read dir resolver resolver_args version state
do
+ cd "$APPS"
+
if [ -d "$dir" ]
then
- cd $dir
+ cd "$dir"
+ dir=`pwd`
old_version=$(app conf get app.version)
if [[ $new_version == $old_version ]]
@@ -36,20 +39,32 @@ do
echo "Updating $dir to $version"
app conf set app.version "$version"
app update
- cd ..
else
echo "New application: $dir"
app init -d "$dir" "$resolver" "$resolver_args"
+ cd "$dir"
+ dir=`pwd`
fi
cd "$dir"
if [[ $state == enabled ]]
then
- echo "Starting appliation"
- app start
+ cmd=start
+ title="Starting"
else
- echo "Stopping appliation"
- app stop
+ cmd=stop
+ title="Stopping"
+ fi
+
+ echo "$title appliation"
+ set +e
+ app $cmd
+ ret=$?
+ set -e
+
+ if [[ $ret != 0 ]]
+ then
+ echo "$cmd command failed."
fi
done
unset IFS