#troubleshooting
19 one-liners with this tag.
All one-liners tagged troubleshooting
Analyze server errors (5xx) in the access log
#awk '$9 ~ /^5[0-9][0-9]$/ {print $9, $7}' /var/www/vhosts/system/example.com/logs/access_ssl_log | sort | uniq -c | sort -rn | head -20
Capture network traffic on a port with tcpdump
#tcpdump -i any -nn -c 100 port 25
Check all MySQL tables for errors
#mysqlcheck --all-databases --check --silent
Check all PHP files in a directory for syntax errors
$find /var/www/vhosts/example.com/httpdocs/wp-content/themes -name '*.php' -exec php -l {} \; 2>&1 | grep -v '^No syntax errors'
Check permissions along a path
$namei -l /var/www/vhosts/example.com/httpdocs/index.php
Deactivate a single plugin despite a PHP fatal error
$wp plugin deactivate woocommerce --skip-plugins --skip-themes --path=/var/www/vhosts/example.com/httpdocs
Deactivate all plugins and save the active list
$wp plugin list --status=active --field=name --path=/var/www/vhosts/example.com/httpdocs > /var/www/vhosts/example.com/active-plugins.txt && wp plugin deactivate --all --path=/var/www/vhosts/example.com/httpdocs
Debug SSH connection problems with verbose output
$ssh -vvv -p 22 webuser@server.example.com
Enable the WordPress debug log without displaying errors
$wp config set WP_DEBUG true --raw --path=/var/www/vhosts/example.com/httpdocs && wp config set WP_DEBUG_LOG true --raw --path=/var/www/vhosts/example.com/httpdocs && wp config set WP_DEBUG_DISPLAY false --raw --path=/var/www/vhosts/example.com/httpdocs
Find the route and source IP for a destination
$ip route get 1.1.1.1
Follow a log file live and filter by keywords
#tail -f /var/log/syslog | grep --line-buffered -iE "error|warn|fail"
Follow the error log of a Plesk domain live
#tail -f /var/www/vhosts/system/example.com/logs/error_log
List scheduled WP-Cron events
$wp cron event list --fields=hook,next_run_relative,recurrence --path=/var/www/vhosts/example.com/httpdocs
Show all failed systemd units
$systemctl --failed --no-pager
Show only error messages in the system journal
#journalctl -p err -b --no-pager
Show open files of a process
#lsof -p 1234
Switch to a default WordPress theme
$wp theme activate twentytwentyfour --skip-themes --skip-plugins --path=/var/www/vhosts/example.com/httpdocs
Test a command in the minimal cron environment
$env -i SHELL=/bin/sh PATH=/usr/bin:/bin HOME="$HOME" LOGNAME="$(id -un)" /bin/sh -c 'wp --path=/var/www/vhosts/example.com/httpdocs cron event run --due-now'
Test the MTU with ping
$ping -M do -s 1472 -c 3 example.com