refact deploy

This commit is contained in:
2020-03-29 15:49:14 +02:00
parent f59a5377af
commit 5a94759e35

View File

@@ -3,26 +3,15 @@
input=".env"
while IFS= read -r line
do
if [ "APP_ENV" == "${line%=*}" ];
then
if [ "APP_ENV" == "${line%=*}" ]; then
env="${line##*=}"
fi
if [ "DB_DATABASE" == "${line%=*}" ];
then
elif [ "DB_DATABASE" == "${line%=*}" ]; then
database="${line##*=}"
fi
if [ "DB_USERNAME" == "${line%=*}" ];
then
elif [ "DB_USERNAME" == "${line%=*}" ]; then
user="${line##*=}"
fi
if [ "DB_PASSWORD" == "${line%=*}" ];
then
elif [ "DB_PASSWORD" == "${line%=*}" ]; then
pass="${line##*=}"
fi
done < "$input"
year=$(date +"%Y")
@@ -31,7 +20,14 @@ day=$(date +"%d")
hour=$(date +"%H")
minutes=$(date +"%M")
mysqldump --user="$user" --password="$pass" -B "$database" > storage/logs/database/save-$database-$year$month$day-$hour$minutes.sql
if [ -d "storage/logs/database" ];
then
echo "storage/logs/database/ exist"
else
mkdir database
fi
mysqldump --user="$user" --password="$pass" -B "$database" > storage/logs/database/save-"$database"-"$year""$month""$day"-"$hour""$minutes".sql
if [ "production" == "$env" ];
then