49 lines
874 B
Bash
49 lines
874 B
Bash
#!/bin/bash
|
|
|
|
input=".env"
|
|
while IFS= read -r line
|
|
do
|
|
if [ "APP_ENV" == "${line%=*}" ];
|
|
then
|
|
env="${line##*=}"
|
|
fi
|
|
|
|
if [ "DB_DATABASE" == "${line%=*}" ];
|
|
then
|
|
database="${line##*=}"
|
|
fi
|
|
|
|
if [ "DB_USERNAME" == "${line%=*}" ];
|
|
then
|
|
user="${line##*=}"
|
|
fi
|
|
|
|
if [ "DB_PASSWORD" == "${line%=*}" ];
|
|
then
|
|
pass="${line##*=}"
|
|
fi
|
|
|
|
done < "$input"
|
|
|
|
year=$(date +"%Y")
|
|
month=$(date +"%m")
|
|
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 [ "production" == "$env" ];
|
|
then
|
|
echo "en production"
|
|
git pull origin production
|
|
|
|
composer install
|
|
php artisan migrate --force
|
|
php artisan test
|
|
php artisan optimize
|
|
|
|
npm install
|
|
npm run prod
|
|
fi
|