From 5821a949035a5e098a2c6b395818f5efa1c66f8e Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 22 Oct 2013 21:07:55 +0200 Subject: wip --- hooks/post-receive | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'hooks') 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 -- cgit v1.2.3