diff --git a/orbit_service.sh b/orbit_service.sh index b248d6e..46a2710 100644 --- a/orbit_service.sh +++ b/orbit_service.sh @@ -41,8 +41,13 @@ sig () { get_orbit_root () { if [ ! -f $NGINX_ORBIT_SITES/$1 ]; then echo "Site $1 not found" && exit 0; fi - ORBIT_ROOT=`cat $NGINX_ORBIT_SITES/$1 | grep 'root' | grep -v '#' | xargs | awk '{print $2}'`; - ORBIT_ROOT="${ORBIT_ROOT//"/public;"/""}"; + tmp_roots=`cat $NGINX_ORBIT_SITES/$1 | grep -E '^\s*root' | awk '{print $2}' | sed -E 's/;.*//g'| sed -E 's/\/public$//g'`; + ORBIT_ROOT=""; + for d in $tmp_roots; do + if [ -d "$d" ]; then + ORBIT_ROOT="$d"; + fi; + done if [ ! -d "$ORBIT_ROOT" ]; then echo "Site folder $ORBIT_ROOT not found"; ORBIT_ROOT=""; @@ -59,6 +64,7 @@ bundle_orbit () { if [[ -z $args ]]; then args="install" fi + echo "Execing bundle install in $ORBIT_ROOT"; sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle $args"; } case $1 in