|
|
@@ -0,0 +1,37 @@
|
|
|
+# 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/JALP
|
|
|
+mkdir $BACKUP_FOLDER
|
|
|
+
|
|
|
+file_name=/tmp/bkup_jugaralpadel
|
|
|
+new_name=$file_name-$today
|
|
|
+
|
|
|
+echo "Backup file name: " "$new_name"
|
|
|
+
|
|
|
+echo "extrayendo usuarios..."
|
|
|
+curl https://jugaralpadel.es/usuarios/api/usuarios/ > $BACKUP_FOLDER/usuarios.json
|
|
|
+
|
|
|
+echo "extrayendo ayuda..."
|
|
|
+curl https://jugaralpadel.es/api/ayuda/ > $BACKUP_FOLDER/ayuda.json
|
|
|
+
|
|
|
+for i in eventos reservas noticias listaespera lugares
|
|
|
+do
|
|
|
+ echo "extrayendo $i..."
|
|
|
+ curl https://jugaralpadel.es/eventos/api/$i/ > $BACKUP_FOLDER/$i.json
|
|
|
+done
|
|
|
+
|
|
|
+sudo zip $new_name.zip $BACKUP_FOLDER/*
|
|
|
+
|
|
|
+message="Backup stored "$today
|
|
|
+
|
|
|
+sudo -u creylopez echo "Jugaralpadel backup adjunto" |mail -s "Backup SQL de jugaralpadel" creylopez@yahoo.es -A $new_name.zip
|
|
|
+
|
|
|
+sudo rm $new_name.zip
|