Files
linuxkit/alpine/packages/diagnostics/diagnostics-download
David Scott 48a3916095 diagnostics: apply a timeout to all commands
This should avoid unnecessary blocking if (for example) the network is
down.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-02 13:55:36 +01:00

36 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# Gather diagnostic data and write a .tar file to stdout
TEMP=$(mktemp -d diagnoseXXXXXXX)
trap 'rm -rf "$TEMP"' EXIT
mkdir $TEMP/moby
cd $TEMP/moby
# gather diagnostic data
timeout -t 2 date > "date"
timeout -t 2 uname -a > "uname -a"
timeout -t 2 ps uax > "ps -aux"
timeout -t 2 netstat -tulpn > "netstat -tulpn"
timeout -t 2 iptables-save > "iptables-save"
timeout -t 2 ifconfig -a > "ifconfig -a"
timeout -t 2 route -n > "route -n"
timeout -t 2 brctl show > "brctl show"
timeout -t 2 dmesg > dmesg
timeout -t 2 docker ps > "docker ps"
timeout -t 2 tail /var/log/docker.log > "docker.log"
timeout -t 2 mount > "mount"
timeout -t 2 df > "df"
timeout -t 2 ls -l /var &> "ls -l var"
timeout -t 2 ls -l /var/lib &> "ls -l var_lib"
timeout -t 2 ls -l /var/lib/docker &> "ls -l var_lib_docker"
timeout -t 2 /usr/bin/diagnostics > "diagnostics"
timeout -t 2 ping -w 5 8.8.8.8 &> "ping -w 5 8.8.8.8"
timeout -t 2 cp /etc/resolv.conf .
timeout -t 2 dig docker.com > "dig docker.com"
timeout -t 2 wget -O - http://www.docker.com/ &> "wget docker.com"
# send everything to the client
cd ..
tar -c .