From bdc485838c6c53b956fe970c7792321e7bf839e6 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Thu, 12 Jan 2023 13:34:46 +0100 Subject: [PATCH] =?UTF-8?q?A=C3=B1ado=20la=20shell=20para=20hacer=20copias?= =?UTF-8?q?=20de=20Gogs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gogs/copyGogsDB | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 Gogs/copyGogsDB diff --git a/Gogs/copyGogsDB b/Gogs/copyGogsDB new file mode 100755 index 00000000..58858fc5 --- /dev/null +++ b/Gogs/copyGogsDB @@ -0,0 +1,24 @@ +# Backup date + +today=$(date "+%Y_%m_%d-%H_%M_%S") + +echo "Current date: $today" + +# build up filename + +# destination folder (change to your own needs) + +BACKUP_FOLDER=/tmp + +file_name=$BACKUP_FOLDER/bkup_gogs +new_name=$file_name-$today.sql +echo "Backup file name: " "$new_name" + +#sudo docker exec `sudo docker container ls | grep mysql_gogs | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 gogs > $new_name +sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n gogs|grep mysql|cut -f1 -d' '` -n gogs -- /usr/bin/mysqldump -u root --password=Dsa-0213 gogs > $new_name + +message="Backup stored "$today + +sudo -u creylopez cat $new_name | mail -s "Gogs backup finished" "creylopez@yahoo.es" + +sudo rm $new_name