From 7c3fdea7b83e49ba19becd39b08c281e8f8c37c8 Mon Sep 17 00:00:00 2001 From: Alessandro Rabiti Date: Tue, 27 Jan 2026 23:38:46 +0100 Subject: [PATCH] fix: corretto script gestione_snapshot.sh --- .bashrc | 19 +++++++++++++++++++ .govc.env | 2 +- Containerfile | 4 +++- gestione_snapshot.sh | 5 +++-- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 .bashrc diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..ee2df26 --- /dev/null +++ b/.bashrc @@ -0,0 +1,19 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. + +# Note: PS1 is set in /etc/profile, and the default umask is defined +# in /etc/login.defs. You should not need this unless you want different +# defaults for root. +# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' +# umask 022 + +# You may uncomment the following lines if you want `ls' to be colorized: +# export LS_OPTIONS='--color=auto' +# eval "$(dircolors)" +# alias ls='ls $LS_OPTIONS' +alias ll='ls $LS_OPTIONS -l' +# alias l='ls $LS_OPTIONS -lA' +# +# Some more alias to avoid making mistakes: +# alias rm='rm -i' +# alias cp='cp -i' +# alias mv='mv -i' diff --git a/.govc.env b/.govc.env index 8ce5620..d4ec765 100644 --- a/.govc.env +++ b/.govc.env @@ -1,4 +1,4 @@ -export GOVC_URL="https://xxxx.yyyy.zz/" +#export GOVC_URL="https://xxxx.yyyy.zz/" export GOVC_USERNAME="username" export GOVC_PASSWORD="password" export GOVC_INSECURE=1 diff --git a/Containerfile b/Containerfile index 932b0dd..65c6535 100644 --- a/Containerfile +++ b/Containerfile @@ -20,13 +20,15 @@ RUN curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/gov # Creo la directory dove importare gli script RUN mkdir -p /opt/app +COPY .bashrc /root/ # Importo gli script COPY procedura.sh /opt/app/ COPY create_db_mk3.sql /opt/app/ COPY .govc.env /opt/app/ COPY popola_db_mk3.sh /opt/app/ +COPY gestione_snapshot.sh /opt/app/ # Source env e shell interattiva -ENTRYPOINT ["bash", "-c", "source /opt/app/.govc.env && exec bash"] +ENTRYPOINT ["bash", "-c", "cd /opt/app && source /opt/app/.govc.env && exec bash"] #ENTRYPOINT ["bash", "-c"] diff --git a/gestione_snapshot.sh b/gestione_snapshot.sh index ca5d66b..4955b4d 100755 --- a/gestione_snapshot.sh +++ b/gestione_snapshot.sh @@ -39,6 +39,7 @@ VM_LIST_VCSRA=( "25001_ftpprod1vm" "25001_asdevjitsi1vm" "25001_htprodurls1vm" + "25001_htprodcat1vm" ) VM_LIST_VCSPR=( @@ -83,7 +84,7 @@ case "$option" in vars_vm=$(basename "$vars") # eseguo lo snapshot - govc snapshot.create -dc=$vars_dc -vm=$vars_dc -m=false -q=true -d="$commento" $snapshot_name + govc snapshot.create -dc=$vars_dc -vm=$vars_vm -m=false -q=true -d="$commento" $snapshot_name done ;; @@ -99,7 +100,7 @@ case "$option" in vars_vm=$(basename "$vars") # eseguo lo snapshot - govc snapshot.create -dc=$vars_dc -vm=$vars_dc -m=false -q=true -d="$commento" $snapshot_name + govc snapshot.create -dc=$vars_dc -vm=$vars_vm -m=false -q=true -d="$commento" $snapshot_name done ;;