fix: Check first in $PATH for nginx, use sbin location as backup

This commit is contained in:
Manuel Colmenero committed 2017-09-18 21:19:30 +02:00
1 parent bada02a122
commit c49f81cd8b
1 file changed
+8 -4
+8 -4
View File
@@ -8,10 +8,14 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions"
get_nginx_location() { get_nginx_location() {
declare desc="check that nginx is at the expected location and return it" declare desc="check that nginx is at the expected location and return it"
local NGINX_LOCATION="/usr/sbin/nginx" local NGINX_LOCATION=$(which nginx 2>/dev/null)
if ! [[ -x "$NGINX_LOCATION" ]]; then
dokku_log_fail "Could not find nginx binary at ${NGINX_LOCATION}." if [[ -z "$NGINX_LOCATION" ]]; then
exit 1; NGINX_LOCATION="/usr/sbin/nginx"
if ! [[ -x "$NGINX_LOCATION" ]]; then
dokku_log_fail "Could not find nginx binary in \$PATH or at '${NGINX_LOCATION}'."
exit 1;
fi
fi fi
echo "$NGINX_LOCATION" echo "$NGINX_LOCATION"
} }