Skip to content

Commit

Permalink
(#19) script to collect support info
Browse files Browse the repository at this point in the history
  • Loading branch information
akeyder committed Jul 24, 2023
1 parent 186897e commit 6127637
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions contrib/bin/support.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

script_home=$(dirname "$(realpath "$0")")
. "$script_home/common.sh"

SUPPORT_LOG_NAME="support-log"
SUPPORT_LOG_HOME="$script_home/$SUPPORT_LOG_NAME"

rm -rf "$SUPPORT_LOG_HOME"
mkdir -p "$SUPPORT_LOG_HOME"
touch "$SUPPORT_LOG_HOME/env"

echo -e "==== OS VERSION ====" | tee "$SUPPORT_LOG_HOME/env" > /dev/null
cat /etc/os-release | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null

echo -e "\n==== Docker VERSION ====" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
docker version | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null

echo -e "\n==== Docker Compose VERSION ====" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
docker-compose version | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null

echo -e "\n==== Mem INFO ====" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
cat /proc/meminfo | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null

echo -e "\n==== CPU INFO ====" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
cat /proc/cpuinfo | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
lscpu | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null

echo -e "\n==== Disk INFO ====" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
df -h "$script_home" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null
df -h "$(which docker)" | tee -a "$SUPPORT_LOG_HOME/env" > /dev/null

cp "$script_home/.version" "$SUPPORT_LOG_HOME/version"
cp "$script_home/config/relayer/version.log" "$SUPPORT_LOG_HOME/relayer.version.log"
cp "$script_home/config/refiner/version.log" "$SUPPORT_LOG_HOME/relayer.version.log"
docker cp srpc2-relayer:/version "$SUPPORT_LOG_HOME/relayer.version"
docker cp srpc2-refiner:/version "$SUPPORT_LOG_HOME/refiner.version"

docker container inspect srpc2-relayer > "$SUPPORT_LOG_HOME/relayer.info"
docker container inspect srpc2-refiner > "$SUPPORT_LOG_HOME/refiner.info"

relayer_container_path="$(dirname `docker container inspect srpc2-relayer | grep LogPath | cut -d \" -f4`)"
refiner_container_path="$(dirname `docker container inspect srpc2-refiner | grep LogPath | cut -d \" -f4`)"

ln -sf "$relayer_container_path" "$SUPPORT_LOG_HOME/relayer"
ln -sf "$refiner_container_path" "$SUPPORT_LOG_HOME/refiner"

tar -czvhf "$SUPPORT_LOG_HOME-$(date +%s).tar.gz" -C "$script_home" "$SUPPORT_LOG_NAME"
rm -rf "$SUPPORT_LOG_HOME"
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ install() {
cp "./${src_dir}/bin/start.sh" "${INSTALL_DIR}/start.sh"
cp "./${src_dir}/bin/stop.sh" "${INSTALL_DIR}/stop.sh"
cp "./${src_dir}/bin/common.sh" "${INSTALL_DIR}/common.sh"
cp "./${src_dir}/bin/support.sh" "${INSTALL_DIR}/support.sh"

echo "Starting..."
./"${INSTALL_DIR}"/start.sh
Expand Down

0 comments on commit 6127637

Please sign in to comment.