Created
March 2, 2017 19:58
-
-
Save brianoflan/aed83c560275eb3b37b5e3b4a32a6714 to your computer and use it in GitHub Desktop.
Functions including debug_ruby()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
debug_linux() { | |
local this=debug_linux | |
local label=$1 ; | |
[[ $label ]] || label=0 ; | |
local outputfile=$2 ; | |
[[ $outputfile ]] || outputfile=$this.$label.txt ; | |
{ | |
echo $this ; | |
pwd ; | |
echo "Uname:" | |
echo -n ' ' ; uname -a ; | |
echo ; | |
echo "yum list installed:" | |
yum list installed | perl -ne 'print " $_"'; | |
echo ; | |
echo "cat /proc/cmdline:" | |
cat /proc/cmdline | perl -ne 'print " $_"'; | |
echo ; | |
echo "systemctl:" | |
systemctl | perl -ne 'print " $_"'; | |
echo ; | |
} &> $outputfile ; | |
} | |
debug_python() { | |
local label=$1 ; | |
[[ $label ]] || label=0 ; | |
local outputfile=$2 ; | |
[[ $outputfile ]] || outputfile=debug_python.$label.txt ; | |
local is_subdir=$(basename $(pwd) | egrep '^run_') | |
if [[ $is_subdir ]] ; then | |
outputfile="../$outputfile" ; | |
is_subdir=$(cd .. ; basename $(pwd) | egrep '^run_') ; | |
[[ -z $is_subdir ]] || outputfile="../$outputfile" ; | |
fi ; | |
{ | |
# local tmpf=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` ; | |
echo debug_python ; | |
pwd ; | |
echo "Python environment:" | |
# env | egrep '(gem|rbenv|ruby|rvm)' | egrep -v 'PATH' | sort | perl -ne 'print " $_"'; | |
env | egrep -v 'PATH' | sort | perl -ne 'print " $_"'; | |
echo ; | |
echo "Paths:" | |
# env | egrep '(gem|rbenv|ruby|rvm|PATH)' | egrep 'PATH' | sort | perl -ne 's/[=:]/\n /g ; print " $_"' ; | |
env | egrep 'PATH' | sort | perl -ne 's/[=:]/\n /g ; print " $_"' ; | |
echo ; | |
echo "python --version" ; | |
python --version ; | |
echo ; | |
echo "pip --version" ; | |
pip --version ; | |
echo ; | |
echo "virtualenv --version" ; | |
virtualenv --version ; | |
echo ; | |
} &> $outputfile ; | |
} | |
debug_python3() { | |
local label=$1 ; | |
[[ $label ]] || label=0 ; | |
local outputfile=$2 ; | |
[[ $outputfile ]] || outputfile=debug_python3.$label.txt ; | |
local is_subdir=$(basename $(pwd) | egrep '^run_') | |
if [[ $is_subdir ]] ; then | |
outputfile="../$outputfile" ; | |
is_subdir=$(cd .. ; basename $(pwd) | egrep '^run_') ; | |
[[ -z $is_subdir ]] || outputfile="../$outputfile" ; | |
fi ; | |
{ | |
# local tmpf=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` ; | |
echo debug_python3 ; | |
pwd ; | |
echo "Python environment:" | |
# env | egrep '(gem|rbenv|ruby|rvm)' | egrep -v 'PATH' | sort | perl -ne 'print " $_"'; | |
env | egrep -v 'PATH' | sort | perl -ne 'print " $_"'; | |
echo ; | |
echo "Paths:" | |
# env | egrep '(gem|rbenv|ruby|rvm|PATH)' | egrep 'PATH' | sort | perl -ne 's/[=:]/\n /g ; print " $_"' ; | |
env | egrep 'PATH' | sort | perl -ne 's/[=:]/\n /g ; print " $_"' ; | |
echo ; | |
echo "python3 --version" ; | |
python3 --version ; | |
echo ; | |
echo "pip3 --version" ; | |
pip3 --version ; | |
echo ; | |
echo "virtualenv --version" ; | |
virtualenv --version ; | |
echo ; | |
} &> $outputfile ; | |
} | |
debug_ruby() { | |
local label=$1 ; | |
[[ $label ]] || label=0 ; | |
local outputfile=$2 ; | |
[[ $outputfile ]] || outputfile=debug_ruby.$label.txt ; | |
local is_subdir=$(basename $(pwd) | egrep '^run_') | |
if [[ $is_subdir ]] ; then | |
outputfile="../$outputfile" ; | |
is_subdir=$(cd .. ; basename $(pwd) | egrep '^run_') ; | |
[[ -z $is_subdir ]] || outputfile="../$outputfile" ; | |
fi ; | |
{ | |
# local tmpf=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` ; | |
echo debug_ruby ; | |
pwd ; | |
echo "Ruby-ish environment:" | |
env | egrep '(gem|rbenv|ruby|rvm)' | egrep -v 'PATH' | sort | perl -ne 'print " $_"'; | |
echo ; | |
echo "Paths:" | |
env | egrep '(gem|rbenv|ruby|rvm|PATH)' | egrep 'PATH' | sort | perl -ne 's/[=:]/\n /g ; print " $_"' ; | |
echo ; | |
echo "gem env" ; | |
gem env ; | |
echo ; | |
echo "gem list" ; | |
gem list ; | |
echo ; | |
} &> $outputfile ; | |
} | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment