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.
 
 
 
 
 
 

27 lines
720 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_drupal
new_name=$file_name-$today.sql
echo "Backup file name: " "$new_name"
sudo kubectl --kubeconfig /home/creylopez/.kube/config -n drupal exec `sudo kubectl --kubeconfig /home/creylopez/.kube/config get pod -n drupal | grep mysql | cut -f1 -d' '` -- /usr/bin/mysqldump -u root --password=Dsa-0213 drupaldb > $new_name
message="Backup stored "$today
zip $new_name.zip $new_name
sudo -u creylopez echo "Copia terminada" | mail -s "Drupal backup finished" "creylopez@yahoo.es" -A $new_name.zip
sudo rm $new_name*