2020-12-03 20:48:04 -08:00
|
|
|
#!/bin/bash
|
|
|
|
# TODO allow debug to have managment flags and levels
|
|
|
|
function debug () {
|
|
|
|
[[ $BASH_DEBUG ]] && echo -e "#### DEBUG ####\n $@ \n#####" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
# alias debug_on="sudo -i uncomment BASH_DEBUG /etc/bash.bashrc"
|
|
|
|
# alias debug_off="sudo -i comment BASH_DEBUG /etc/bash.bashrc"
|
2022-02-20 12:44:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
# *************** DEBUGGING ***********************
|
|
|
|
# module_load debug
|
|
|
|
# if [[ $? -ne 0 ]]; then
|
|
|
|
# echo "unable to load a 'debug' module using a noop for debug function"
|
|
|
|
# # noop
|
|
|
|
# function debug () {
|
|
|
|
# :
|
|
|
|
# }
|
|
|
|
# fi
|
|
|
|
|
|
|
|
# [[ ! $- == *i* ]] && exec >> ~/logs/load.log && exec 2>&1
|
|
|
|
# export BASH_DEBUG=true
|
|
|
|
|
|
|
|
# uncomment for debugging
|
|
|
|
# echo $USER running load script in $DIR
|
|
|
|
# echo callers
|
|
|
|
# caller
|
|
|
|
# echo $(ps -o comm= $PPID)
|
|
|
|
# echo -----
|
|
|
|
# echo $BASH_SHELL_DIRS
|
|
|
|
# ******************END DEBUGGING *******************************
|
|
|
|
|
|
|
|
# ***************** LOGGING *****************
|
|
|
|
# function nilog () {
|
|
|
|
# [[ ! $- == *i* ]] && echo -e "-----\n $USER $*" &>> ~/logs/load.log
|
|
|
|
# }
|
|
|
|
|
|
|
|
# nilog "called load.sh $(date)"
|
|
|
|
# nilog caller: $(caller)
|
|
|
|
# nilog pid: $(ps -o comm= $PPID)
|
|
|
|
|
|
|
|
# *
|