|
|
# 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_reymota
|
|
|
new_name=$file_name-$today.sql
|
|
|
|
|
|
artistas=$BACKUP_FOLDER/artistas-$today.json
|
|
|
albumes=$BACKUP_FOLDER/albumes-$today.json
|
|
|
canciones=$BACKUP_FOLDER/canciones-$today.json
|
|
|
|
|
|
vehiculos=$BACKUP_FOLDER/vehiculos-$today.json
|
|
|
repostajes=$BACKUP_FOLDER/repostajes-$today.json
|
|
|
|
|
|
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/artistas/ > $artistas
|
|
|
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/albumes/ > $albumes
|
|
|
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/lyrics/api/canciones/ > $canciones
|
|
|
|
|
|
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/repostajes/api/vehiculos/ > $vehiculos
|
|
|
curl http://reymota-reymota.apps.ocp-cluster.reymota.lab/repostajes/api/repostajes/ > $repostajes
|
|
|
|
|
|
zip $BACKUP_FOLDER/reymota-$today.zip $artistas $albumes $canciones $vehiculos $repostajes
|
|
|
|
|
|
#kubectl --kubeconfig /home/creylopez/.kube/kubeconfig-okd -n reymota exec -ti deployment.apps/db -- /usr/lib/postgresql/15/bin/pg_dump --username=creylopez --dbname=reymota > $new_name
|
|
|
|
|
|
message="Backup stored "$today
|
|
|
|
|
|
#sudo -u creylopez cat $new_name | mail -s "ReyMotaApps backup finished" "creylopez@yahoo.es"
|
|
|
sudo -u creylopez echo "Reymota backup adjunto" |mail -s "Backup de Reymota" creylopez@yahoo.es -A $BACKUP_FOLDER/reymota-$today.zip
|
|
|
|
|
|
#sudo rm $new_name
|
|
|
rm $BACKUP_FOLDER/artista*
|
|
|
rm $BACKUP_FOLDER/albumes*
|
|
|
rm $BACKUP_FOLDER/canciones*
|
|
|
rm $BACKUP_FOLDER/vehiculos*
|
|
|
rm $BACKUP_FOLDER/repostajes*
|
|
|
|