You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
620 B

# 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_jugaralpadel
new_name=$file_name-$today.sql
echo "Backup file name: " "$new_name"
kubectl --kubeconfig /home/creylopez/.kube/config -n jugaralpadel exec -ti deployment.apps/db -- /usr/lib/postgresql/15/bin/pg_dump --username=creylopez --dbname=jugaralpadel > $new_name
message="Backup stored "$today
sudo -u creylopez cat $new_name | mail -s "Jugar al Pádel backup finished" "creylopez@yahoo.es"
sudo rm $new_name