diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-11-18 06:30:24 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-11-18 17:00:40 +0300 |
commit | ede912f8db3503d2681d77cf452108e0c68232f9 (patch) | |
tree | fd4020373405af64db2f06da98c17d5101d7b3e8 /bin/ncp-report | |
parent | 2c25fa91d3402dac0473a98bccf6ac0f8af2116f (diff) |
added ncp-diag and ncp-reportv0.36.0
Diffstat (limited to 'bin/ncp-report')
-rwxr-xr-x | bin/ncp-report | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/bin/ncp-report b/bin/ncp-report new file mode 100755 index 00000000..efaf76fb --- /dev/null +++ b/bin/ncp-report @@ -0,0 +1,86 @@ +#!/bin/bash + +# NextCloudPi diagnostics report +# +# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com> +# GPL licensed (see end of file) * Use at your own risk! +# +# Usage: +# sudo ncp-report +# +# More at https://ownyourbits.com +# + +function open_summary() +{ + echo " +<details> +<summary>$@</summary> +\`\`\` +" +} + +function close_summary() +{ + echo " +\`\`\` +</details> +" +} + +[[ ${EUID} -ne 0 ]] && { + printf "Must be run as root. Try 'sudo $0'\n" + exit 1 +} + +echo "<--! Paste this in GitHub report -->" + +## + +open_summary "NextCloudPi diagnostics" +ncp-diag | column -t -s'|' +close_summary + +## + +open_summary "Nextcloud configuration" +sudo -u www-data /var/www/nextcloud/occ config:list system +close_summary + +## + +open_summary "HTTPd logs" +tail -20 /var/log/apache2/error.log +close_summary + +## + +open_summary "Database logs" +tail -20 /var/log/mysql/*.log +close_summary + +## + +DATADIR="$( grep datadirectory /var/www/nextcloud/config/config.php | + awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )" + +open_summary "Nextcloud logs" +tail -20 "$DATADIR"/nextcloud.log +close_summary + +# License +# +# This script is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this script; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA |