User Tools

Site Tools


zz_deprecated:bash:common_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
linux:bash:common_functions [2022/11/16 08:16] dodgerzz_deprecated:bash:common_functions [2022/11/16 08:18] – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== Useful bash functions ====== 
- 
- 
-<WRAP center round info 60%> 
-**DEPRECATED, USE** [[https://git.ciberterminal.net/dodger/script_template|Script template]] 
-</WRAP> 
- 
- 
- 
- 
-===== ssh_it ===== 
- 
-<code bash> 
-# CONFIG SECTION 
-SSHIT="${SSH} ${USERNAME}@${DSTHOST}" 
- 
-# FUNCTION SECTION 
-ssh_it() 
-{ 
-  ${SSHIT} $* 2>/dev/null 
-} 
-</code> 
- 
-===== debug_me ===== 
-<code bash> 
-debug_me() 
-{ 
-  if [[ ${DEBUG} -eq 0 ]] ; then 
-    echo -e "${LIGHTBLUE}DEBUG: ${RESET}$*" 
-  fi 
-} 
-</code> 
- 
-Dependencies: 
-  * [[#bash_colors]] 
- 
-===== check_vm ===== 
-For nutanix: 
- 
-<code bash> 
-check_vm() 
-{ 
-    local THEVM="${1}" 
-    if [[ $(ssh_it "${ACLI} vm.list" | egrep -i "${THEVM^^}") ]] ; then 
-        debug_me "${LIGHTGREEN}${THEVM}${RESET} exists on ${CVMIP}" 
-        #echo -e "${LIGHTGREEN}${THEVM}${RESET} exists on ${CVMIP}" 
-        return 0 
-    else 
-        debug_me "${LIGHTRED}${THEVM}${RESET} NOT exists on ${CVMIP}" 
-        #echo -e "${LIGHTRED}${THEVM}${RESET} NOT exists on ${CVMIP}" 
-        return 1 
-    fi 
-} 
- 
-# calling it 
-check_vm "${VMNAME}" 
-RES=$? 
-</code> 
- 
-Dependency: 
-  * [[#ssh_it]] 
-  * [[#debug_me]] 
-  * ''${CVMIP}'' must be defined 
- 
- 
- 
- 
-====== bash_colors ====== 
- 
-<code bash> 
-LIGHTGREEN="\033[1;32m" 
-LIGHTRED="\033[1;31m" 
-LIGHTBLUE="\033[1;34m" 
-WHITE="\033[0;37m" 
-RESET="\033[0;00m" 
-</code> 
- 
- 
  
zz_deprecated/bash/common_functions.txt · Last modified: 2022/11/16 08:18 by dodger