Merge pull request #1469 from progrium/1352_mh-nginx-logs-commands
Add nginx:access-logs and nginx:error-logs without sudo requirement
This commit is contained in:
commit
1be4b94226
2 files changed
+22
-1
No files matched your search
@@ -41,7 +41,7 @@ if [[ "${args[0]}" =~ ^--.* ]]; then
|
|||||||
fi
|
fi
|
||||||
! has_tty && DOKKU_QUIET_OUTPUT=1
|
! has_tty && DOKKU_QUIET_OUTPUT=1
|
||||||
|
|
||||||
if [[ $(id -un) != "dokku" && $1 != plugin:*install* && $1 != "plugin:update" ]]; then
|
if [[ $(id -un) != "dokku" && $1 != plugin:*install* && $1 != "plugin:update" && $1 != nginx:*-logs ]]; then
|
||||||
sudo -u dokku -E -H $0 "$@"
|
sudo -u dokku -E -H $0 "$@"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -163,9 +163,30 @@ EOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
nginx:access-logs|nginx:error-logs)
|
||||||
|
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||||
|
verify_app_name "$2"
|
||||||
|
APP="$2"
|
||||||
|
|
||||||
|
NGINX_LOGS_TYPE=${1#nginx:}
|
||||||
|
NGINX_LOGS_TYPE=${NGINX_LOGS_TYPE%-logs}
|
||||||
|
NGINX_LOGS_PATH="/var/log/nginx/$APP-$NGINX_LOGS_TYPE.log"
|
||||||
|
|
||||||
|
if [[ $3 == "-t" ]]; then
|
||||||
|
NGINX_LOGS_ARGS="-F"
|
||||||
|
else
|
||||||
|
NGINX_LOGS_ARGS="-n 20"
|
||||||
|
fi
|
||||||
|
|
||||||
|
tail "$NGINX_LOGS_ARGS" "$NGINX_LOGS_PATH"
|
||||||
|
;;
|
||||||
|
|
||||||
help | nginx:help)
|
help | nginx:help)
|
||||||
cat<<EOF
|
cat<<EOF
|
||||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||||
|
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||||
|
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user