Oracle VM CPU pin map

ovm_cpu_pin_map.sh
#!/bin/bash
#####################################################
# OVM CPU PIN MAP v1.6
# Keszitette: Agoston Peter
#####################################################
CPU_SUM_WARN=5
CPU_SUM_CRIT=10
OVM_ADMIN_PASSWD=PAssword123
OVMC="/opt/ovm_utils/ovm_vmcontrol"
OVS_SSH_KEY="/root/.ssh/id_ecdsa_ovs"
SSHC="ssh -n -p 10000 admin@localhost"
WORKDIR=$(dirname $(readlink -f $0))
FULL_BACKUP_FILE="${WORKDIR}/all_cpu_pins.bkp.last"
LOGFILE="${WORKDIR}/ovm_cpu_pin_map.log"
if [[ -z "$OVM_ADMIN_PASSWD" ]]; then
	read -s -p "Add meg az oracle VM Manager admin jelszavat: " OVM_ADMIN_PASSWD
fi
cd $WORKDIR
# A terminálba SSH-n bejelentkezett user
if egrep -q "SigIgn:\s.{15}[13579bdf]" /proc/$$/status ; then # nohup esetén
    ACT_TTY=$(ps -ef | awk "/$$/{if ("'$2'"=$$"') print $6}' | head -n1 | awk -F'/' '{print $2}')
else
    ACT_TTY=$(tty|grep -oP '(?<=/dev/pts/).*')
fi
SSH_USER=$(w | awk '/pts\/'${ACT_TTY}'\s/{print $1}')
 
red=$'\e[1;31m'
grn=$'\e[1;32m'
yel=$'\e[1;33m'
blu=$'\e[1;34m'
mag=$'\e[1;35m'
cyn=$'\e[1;36m'
whi=$'\e[1;37m'
inv=$'\e[7;37m'
gry=$'\e[1;90m'
end=$'\e[0m'
 
 
function fejlec {
    # $1: CIM, $2: hossz
    FEJLEC=`echo $1 | tr '[:lower:]' '[:upper:]'`
    KIMENET="-=[ ${yel}$FEJLEC${end} ]=-"
    for I in `seq 1 $((($2-${#FEJLEC}-3)/2))`; do
        KIMENET="_$(echo $KIMENET)_"
    done
    echo -e $KIMENET
}
 
 
function vastag_fejlec {
    # $1: CIM, $2: hossz
    FEJLEC=`echo $1 | tr '[:lower:]' '[:upper:]'`
    KIMENET="-=[ ${yel}$FEJLEC${whi} ]=-"
    printf "${whi}"
    for I in `seq 1 $2`; do printf '#'; done
    echo
    for I in `seq 1 $((($2-${#FEJLEC}-7)/2))`; do
        KIMENET="#$(echo $KIMENET)#"
    done
    echo -e $KIMENET
    printf "${whi}"
    for I in `seq 1 $2`; do printf '#'; done
    printf "${end}"
}
 
function show_parameters {
    echo "Parancssori paraméterek:"
    echo -e "Használat: $0 -d ADATBÁZIS_NÉV -r RETENTION -h"
    echo -e "    -b|--backup-all    : Mentést készít minden VM-ről egyetlen fájlba [opcionális]"
    echo -e "    -c|--check PARAM   : Leellenőrzi, hogy van-e eltérés a legutolsó teljes mentéshez képest a CPU pinekben és emailt küld a PARAM címre, ha van [opcionális]"
    echo -e "    -h|--help          : Paraméter lista kiítása [opcionális]"
    echo -e "Pl: $0 -c rgzd@aegon.hu${end}"
}
 
[[ ! $@ =~ -(c|-check) ]] && echo Kulcs ellenorzese a CLI-hez...
if [[ $(ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=5 admin@localhost -p 10000 list manager |grep -c Success) -eq 0 ]]; then
        echo "Nincs SSH kulcs a CLI-hez, legeneralom:"
#       read -s -p "Add meg az oracle VM Manager administrator jelszavat: " OVM_PASSWD
        echo "Kulcs legeneralasa:"
        ssh-keygen -t rsa
        echo "Publikus kulcs masolasa a /home/oracle/.ssh/ovmcli_authorized_keys-be..."
        su - oracle -c "touch /home/oracle/.ssh/ovmcli_authorized_keys"
        cat ~/.ssh/id_rsa.pub >> /home/oracle/.ssh/ovmcli_authorized_keys
        echo "Elso kapcsolodas (jelszot ker):"
        ssh admin@localhost -p 10000 exit
        echo "Teszt kapcsolodas:"
        if [[ $(ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=5 admin@localhost -p 10000 list manager |grep -c Success) -eq 0 ]]; then
                echo "Sikertelen. Eddig tartott a tudomanyom, ellenorizd mi lehet a gond!"
                exit 1
        else
                echo "Sikeres!"
        fi
fi
#
<< 'komment'
echo Kulcs ellenorzese az OVS-ekhez...
if [[ -z $SSH_AUTH_SOCK ]]; then
	printf "ssh-agent (újra)indítása... "
	eval `ssh-agent -s`
	echo "Ha jelszó védett az ($OVS_SSH_KEY) kulcsod, akkor azt most add meg: "
	ssh-add $OVS_SSH_KEY
else
	if [[ $(ssh-add -l 2>&1) == "Could not open a connection to your authentication agent." ]]; then
		killall ssh-agent
		eval `ssh-agent -s`
	fi
	if [[ $(ssh-add -l | grep -c "$OVS_SSH_KEY") -eq 0 ]]; then
		printf "Ha jelszó védett az ($OVS_SSH_KEY) kulcsod, akkor azt most add meg: "
	    ssh-add $OVS_SSH_KEY
	fi
fi
set +x
komment
 
CURR_DIR=$(pwd)
cd ${OVMC%/*} >/dev/null 2>&1
if [[ $? -gt 0 || ! -e $OVMC ]]; then
        echo "Vagy az ovm_vmcontrol fajl, vagy az utvonala hibas: $OVMC"
        exit 1
fi
SCRIPT_VER=$(grep -oP '(?<=# OVM CPU PIN MAP )[^)]*$' $WORKDIR/${0##*/})
 
function pin_map {
printf "Melyik OVS(ek) pin terkepet mutassam (szokozokkel elvalasztva)? "
read -e SOME_SERVERS
for OVS in ${SOME_SERVERS:=$SERVERS}; do
    [[ $($SSHC show server name="$OVS" | grep -c 'Status: Success') -eq 0 ]] && continue;
    unset CPU_PIN_SUM
    echo
    CPU_NUM=$($SSHC show server name="$OVS" | grep -c '^.*Cpu.*Processor ')
    fejlec "#$OVS# CPU PIN MAP" $(($MAX_CPU_NUM*3-3))
    VM_NUM=$($SSHC show server name="${OVS}" | grep -c '^.*Vm .*\[.*\]')
    if [[ $VM_NUM -eq 0 ]]; then
        echo -e "${whi}Ezen a szerveren nincs VM.${end}"
        continue
    fi
 
    # CPU PIN MAP
	# VCPU sorszámok
    for CPU in $(seq 0 $(($CPU_NUM-1))); do
    	[[ $(($CPU % ${CORES_PER_SOCKETS[$OVS]})) -eq 0 ]] && separator="$(env printf '\u2551')" || separator="$(env printf '\u2503')"
        printf "${separator}${yel}%02d${end}" $CPU
    done
    echo "$(env printf '\u2551') vCPU"
	# Elválasztó vonal
    for I in $(seq 0 $(($MAX_CPU_NUM-1))); do
        [[ $(($I % ${CORES_PER_SOCKETS[$OVS]})) -eq 0 ]] && printf "$(env printf '\u256b')--" ||printf "$(env printf '\u2542')--"
    done
    echo "$(env printf '\u256b')"
	while read VM; do
        VM_NAME=$(echo $VM | grep -oP '(?<=\[).*(?=\])')
        VM_ID=$(echo $VM | awk '{print $5}')
        PINS=$($OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v $VM_NAME -c getvcpu | awk -F':' '/Current pinned CPU/{print $2}')
        if [[ $PINS =~ - ]]; then
            PIN_TOL=$(echo $PINS | awk -F'-' '{print $1}')
            PIN_IG=$(echo $PINS | awk -F'-' '{print $2}')
            PINS=""
            for I in $(seq $PIN_TOL $PIN_IG); do
                PINS="${PINS# } $I"
            done
        else
            PINS=$(echo $PINS | sed 's/,/ /g')
        fi
 
        for CPU in $(seq 0 $(($CPU_NUM-1))); do
	    	[[ $(($CPU % ${CORES_PER_SOCKETS[$OVS]})) -eq 0 ]] && separator=$(env printf '\u2551') || separator=$(env printf '\u2503')
            if [[ $(echo $PINS | grep -Pc "\b$CPU\b") -eq 1 ]]; then
                printf "${separator}${whi}##${end}"
                CPU_PIN_SUM[$CPU]=$((${CPU_PIN_SUM[$CPU]}+1))
            else
                printf "${separator}${end}  "
            fi
        done
 
        if [[ -z $PINS ]]; then
                echo -e "$(env printf '\u2551') ${red}$VM_NAME [${PINS:-Nincs pinelve}]${end}"
        else
                echo -e "$(env printf '\u2551') ${whi}$VM_NAME [${PINS:-Nincs pinelve}]${end}"
        fi
	done <<< "`$SSHC "show server name=$OVS" | grep '^.*Vm .*\[.*\]' | sort`"
    # CPU pin szumma / cpu
    for I in $(seq 0 $(($MAX_CPU_NUM-1))); do
  		[[ $(($I % ${CORES_PER_SOCKETS[$OVS]})) -eq 0 ]] && printf "$(env printf '\u256b')--" ||printf "$(env printf '\u2542')--"
	done
    echo "$(env printf '\u256b')"
    for CPU in $(seq 0 $(($CPU_NUM-1))); do
  		[[ $(($CPU % ${CORES_PER_SOCKETS[$OVS]})) -eq 0 ]] && separator="$(env printf '\u2551')" || separator="$(env printf '\u2503')"
        if [[ ${CPU_PIN_SUM[$CPU]} -ge $CPU_SUM_CRIT ]]; then
            printf "${separator}${red}%02d${end}" ${CPU_PIN_SUM[$CPU]}
        elif [[ ${CPU_PIN_SUM[$CPU]} -ge $CPU_SUM_WARN ]]; then
            printf "${separator}${yel}%02d${end}" ${CPU_PIN_SUM[$CPU]}
        elif [[ ${CPU_PIN_SUM[$CPU]} -gt 0 ]]; then
            printf "${separator}${grn}%02d${end}" ${CPU_PIN_SUM[$CPU]}
        else
            printf "${separator}${end}  "
        fi
    done
    echo "$(env printf '\u2551') Pins / vCPU"
done
echo
}
 
function vm_pin {
    printf "Mi a VM neve, amit pinelni szeretnel? "
    read INPUT_VM
    [[ $INPUT_VM == "" ]] && continue;
    if [[ $($SSHC show vm name="$INPUT_VM" | grep -c 'Status: Success') -eq 0 ]]; then
        echo "Nincs ilyen VM nalam."
        echo "Nyomj ENTER-t a visszatereshez."; read
        continue;
    fi
    SERVER=$($SSHC show vm name="$INPUT_VM" | grep 'Server =' | grep -oP '(?<=\[).*(?=\])')
    CPU_NUM=$($SSHC show server name="${SERVER}" | grep -c '^.*Cpu.*Processor ')
    echo "Ehhez a VM-hez az alabbi vCPU keszletet hasznalhatod: 0-$(($CPU_NUM-1))"
    printf "Melyik vCPU-kra szeretned pinelni (pl: 0-3; 2,4,6; 25-29)? "
    read INPUT_VCPU_LIST
    if [[ $INPUT_VCPU_LIST == "" ]]; then
        $OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v "$INPUT_VM" -c rmvcpu | sed "s/^/$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: /" | tee -a $LOGFILE 
    else
        $OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v "$INPUT_VM" -c setvcpu -s "$INPUT_VCPU_LIST" | sed "s/^/$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: /" | tee -a $LOGFILE
    fi
	echo | tee -a $LOGFILE
	echo "${red}Ha végeztél minden módosítással, ne felejts el teljes mentést csinálni a pin térképről!${end}"
}
 
function vm_pin_query {
    printf "Mi a VM neve? "
    read INPUT_VM
    [[ $INPUT_VM == "" ]] && continue;
    if [[ $($SSHC show vm name="$INPUT_VM" | grep -c 'Status: Success') -eq 0 ]]; then
        echo "Nincs ilyen VM nalam."
        echo "Nyomj ENTER-t a visszatereshez."; read
        continue;
    fi
    $OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v "$INPUT_VM" -c getvcpu
} 
 
function backup {
    printf "Melyik OVS pin-jeit mentsuk (${SERVERS## })? A teljes mentéshez ($FULL_BACKUP_FILE fájlba) nyomj ENTER-t! "
    read OVSEK
	if [[ -n "$OVSEK" ]]; then
  for OVS in $OVSEK; do
    [[ $OVS == "" ]] && continue;
    if [[ $($SSHC show server name="$OVS" | grep -c 'Status: Success') -eq 0 ]]; then
        echo "$OVS: nincs ilyen OVS nalam."
        continue;
    fi
    read -e -p "A backup fajl neve, abszolut utvonallal: " -i $CURR_DIR/$(date "+%Y%m%d_%H%M")_${OVS}_cpu_pins.bkp FILENAME
    if [[ -e "$FILENAME" ]]; then
        read -p "A fajl mar letezik. Felulirjuk? [I/N] " VALASZ
        [[ "${VALASZ^^}" == "I" ]] || continue;
    fi
    touch $FILENAME
    if [[ $? -ne 0 ]]; then
        echo "A fajl valamiert nem irhato."
        echo "Nyomj ENTER-t a visszatereshez."; read
        continue;
    else 
        echo "A $FILENAME fajl irhato."
    fi
    echo "#ovm_cpu_pin_map Script version: $SCRIPT_VER, Backup date: $(date "+%Y%m%d_%H%M"), Original filename: $FILENAME " > $FILENAME
    while read VM; do
        VM_NAME=$(echo $VM | grep -oP '(?<=\[).*(?=\])')
        PINS=$($OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v $VM_NAME -c getvcpu | awk -F':' '/Current pinned CPU/{print $2}')
        if [[ $PINS =~ - ]]; then
            PIN_TOL=$(echo $PINS | awk -F'-' '{print $1}')
            PIN_IG=$(echo $PINS | awk -F'-' '{print $2}')
            PINS=""
            for I in $(seq $PIN_TOL $PIN_IG); do
                PINS="${PINS# },$I"
            done
        fi
        PINS=$(echo $PINS | sed 's/^,//')
        echo "$OVS;$VM_NAME;$PINS" |tee -a $FILENAME
    done <<< "`$SSHC "show server name=$OVS" | grep '^.*Vm .*\[.*\]' | sort`"
  done
	echo -e "Mentés késztítése: $FILENAME" | sed -u "s/^/$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: /" | sed 's/$/\n/' >> $LOGFILE
	else
		backup_all
	fi	
}
 
function backup_all {
	>$FULL_BACKUP_FILE
	while read OVS; do
		while read VM; do
	        VM_NAME=$(echo $VM | grep -oP '(?<=\[).*(?=\])')
	        PINS=$($OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v $VM_NAME -c getvcpu | awk -F':' '/Current pinned CPU/{print $2}')
	        if [[ $PINS =~ - ]]; then
	            PIN_TOL=$(echo $PINS | awk -F'-' '{print $1}')
	            PIN_IG=$(echo $PINS | awk -F'-' '{print $2}')
	            PINS=""
	            for I in $(seq $PIN_TOL $PIN_IG); do
	                PINS="${PINS# },$I"
	            done
	        fi
	   	PINS=$(echo $PINS | sed 's/^,//')
        	echo "$OVS;$VM_NAME;$PINS" | tee -a "$FULL_BACKUP_FILE"
		done <<< "`$SSHC "show server name=$OVS" | grep '^.*Vm .*\[.*\]' | sort`"
	done <<< "`$SSHC "list server" | awk -F':' '/id:/{print $NF}' | sort -k1.15`"
	echo -e "Teljes mentés készítése." | sed -u "s/^/$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: /" | sed 's/$/\n/' >> $LOGFILE
}
 
function check_pins {
    [[ ! -f "$FULL_BACKUP_FILE" ]] && { echo 'A "$FULL_BACKUP_FILE" fájl nem található. Készíts egy teljes mentést a CPU pin térképről.'; exit 1; }
    while read OVS; do
        while read VM; do
            VM_NAME=$(echo $VM | grep -oP '(?<=\[).*(?=\])')
            PINS=$($OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v $VM_NAME -c getvcpu | awk -F':' '/Current pinned CPU/{print $2}')
            if [[ $PINS =~ - ]]; then
                PIN_TOL=$(echo $PINS | awk -F'-' '{print $1}')
                PIN_IG=$(echo $PINS | awk -F'-' '{print $2}')
                PINS=""
                for I in $(seq $PIN_TOL $PIN_IG); do
                    PINS="${PINS# },$I"
                done
            fi
            PINS=$(echo $PINS | sed 's/^,//')
        [[ $(grep -c ";$VM_NAME;$PINS" "$FULL_BACKUP_FILE") -eq 1 ]] || HIBAS_VMS="${HIBAS_VMS#,},$VM_NAME"
        done <<< "`$SSHC "show server name=$OVS" | grep '^.*Vm .*\[.*\]' | sort`"
    done <<< "`$SSHC "list server" | awk -F':' '/id:/{print $NF}' | sort -k1.15`"
	if [[ -n "$HIBAS_VMS" ]]; then
		echo "Az alábbi VM-ek CPU pin-je eltér a legutolsó mentésben lévőtől: ${HIBAS_VMS#,}" | tee | mail -s "CRITICAL - $(hostname) CPU PIN check" $ALERT_EMAIL
	else
		echo "OK - $(hostname) CPU PIN check"
	fi
}
 
function restore {
    echo -e "A script konyvtaraban ($CURR_DIR/\*.bkp) az alabbi mentesek talalhatok:${grn}"
    grep "^#ovm_cpu_pin_map" $CURR_DIR/*bkp | sed 's/:.*$//'
	[[ -e "$FULL_BACKUP_FILE" ]] && echo "$FULL_BACKUP_FILE"
    echo -e ${end}
    echo "Melyiket toltsem vissza (copy & paste)? "
    read RESTORE_FILENAME
    echo -e ${whi}
    if [[ ! -e "$RESTORE_FILENAME" ]]; then
        echo "A fajl nem letezik."
        echo "Nyomj ENTER-t a visszatereshez."; read
        continue;
    fi
    if [[ $(grep -c "^#ovm_cpu_pin_map" $RESTORE_FILENAME) -eq 0 ]]; then
        echo "Nem megfelelo fejlecu fajl."
        echo "Nyomj ENTER-t a visszatereshez."; read
        continue
    fi
    cat $RESTORE_FILENAME
    echo -e ${end}
    read -e -p "Mehet a VM-ek pinelesenek beallitasa a mentesbol? [I/N] " VALASZ
    [[ "${VALASZ^^}" == "I" ]] || continue;
	echo "${end}$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: Visszatöltés: $RESTORE_FILENAME" >> $LOGFILE
    echo -e "VM nev;VCPU-k;Statusz" | awk -F';' '{printf "%-30s %-30s %-60s",$1,$2,$3}' | sed -u "s/^/${end}$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: ${whi}/" | tee -a $LOGFILE
    echo | tee -a $LOGFILE
    grep -v '^#' $RESTORE_FILENAME | while read SOR; do
        OVS=$(echo $SOR |awk -F';' '{print $1}')
        VM_NAME=$(echo $SOR |awk -F';' '{print $2}')
        VCPU_LIST=$(echo $SOR |awk -F';' '{print $3}')
        echo -e "$VM_NAME;$VCPU_LIST" | awk -F';' '{printf "%-30s %-31s",$1,$2}'
        printf ${red}
        if [[ -z "$VCPU_LIST" ]]; then
            $OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v "$VM_NAME" -c rmvcpu >/dev/null
        else
            $OVMC -u admin -p $OVM_ADMIN_PASSWD -h localhost -v "$VM_NAME" -c setvcpu -s "$VCPU_LIST" >/dev/null
        fi
        [[ $? -eq 0 ]] && echo -e "${grn}OK${end}" 
    done 2>&1 | sed -u "s/^/${end}$(date '+%Y.%m.%d %H.%M.%d | ')${SSH_USER}: /" | tee -a $LOGFILE
	sed -i "s,\x1B\[[0-9;]*[a-zA-Z],,g" $LOGFILE # színkódok törlése a logból
	echo >> $LOGFILE
}
 
#Parancssori paraméterek feldolgozása
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
    -b|--backup-all )
	backup_all
	exit
	;;
    -c|--check )
	shift; ALERT_EMAIL="$1"
	check_pins;
	exit
        ;;
    -h|--help )
        show_parameters;
	exit
        ;;
esac; shift; done
if [[ "$1" == "--" ]]; then shift; fi
 
#################################################### Vezerlo ciklus ####################################################
FUNKCIO="-"
while [[ $FUNKCIO =~ [^qQ] ]]; do ############
FUNKCIO="-"
 
clear
TERMINAL_COLS=$(/usr/bin/tput cols)
vastag_fejlec "Oracle VM CPU pin map $SCRIPT_VER by Agoston Peter" $(($TERMINAL_COLS-5)) '#'
 
echo
echo -e "${yel}Szerverek beolvasasa...${end}"
MAX_CPU_NUM=0
SERVERS=""
declare -A CORES_PER_SOCKETS
while read SERVER; do
    SERVERS="${SERVERS# } ${SERVER}"
    CPU_NUM=$($SSHC show server name="${SERVER}" | grep -c '^.*Cpu.*Processor ')
    if [[ $MAX_CPU_NUM -lt $CPU_NUM ]]; then MAX_CPU_NUM=$CPU_NUM; fi
    VM_NUM=$($SSHC show server name="${SERVER}" | grep -c '^.*Vm .*\[.*\]')
    CORES_PER_SOCKETS[${SERVER}]=$($SSHC show server name="${SERVER}" | awk -F'=' '/Cores per Processor Socket/{print $2}' | sed 's/ //g')
    echo -e "${whi}${SERVER}${end} ${whi}$CPU_NUM${end} ${whi}$VM_NUM${end}" | awk '{printf "%-30s:     %5s vcpu, %5s VM\n",$1,$2,$3}'
done <<< "`$SSHC "list server" | awk -F':' '/id:/{print $NF}' | sort -k1.15`"
 
echo
echo -e "${yel}Valassz funkciot:${end}"
echo -e "[${whi}t${end}] vCPU pin terkep lekerdezese"
echo -e "[${whi}l${end}] VM pinelesenek lekerdezese"
echo -e "[${whi}p${end}] VM pinelesenek modositasa"
echo -e "[${whi}m${end}] Pin terkep mentese fajlba"
echo -e "[${whi}v${end}] Pin terkep visszaallitasa mentesbol"
echo -e "[${whi}q${end}] Kilepes"
FUNKCIO=""
printf ": "; read FUNKCIO
while [[ $FUNKCIO =~ [^tTlLpPmMvVqQ] ]]; do read FUNKCIO; done
case $FUNKCIO in
    [tT] )
        pin_map
        echo "Nyomj ENTER-t a visszatereshez."; read
        ;;
    [lL] )
        vm_pin_query
        echo "Nyomj ENTER-t a visszatereshez."; read
        ;;
    [pP] )
        vm_pin
        echo "Nyomj ENTER-t a visszatereshez."; read
        ;;
    [mM] )
        backup
        echo "Nyomj ENTER-t a visszatereshez."; read
        ;;
    [vV] )
        restore
        echo "Nyomj ENTER-t a visszatereshez."; read
        ;;
esac
done ##############
cd $CURR_DIR
echo "${red}Ha módosításokat végeztél, ugye nem felejtettél el teljes mentést csinálni a pin térképről a végén?${end}"