-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
update.sh
52 lines (41 loc) · 1.2 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/bash
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
White='\033[0;37m' # White
# Clear the caches
php artisan down
php artisan route:clear
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan optimize:clear
php artisan clear
# Try taking pull, if dont work then prompt for stash
if git pull; then
echo "${Green}Git pull successful! Continuing update..."
else
echo "${Yellow}Warning! You have local changes which will get lost. Type Y to continue, N to cancel update."
read continueUpdate
if [ $continueUpdate != 'Y' ]; then
php artisan up
echo "${Red}Update cancelled!"
exit 1
fi
git stash
git pull
fi
export COMPOSER_ALLOW_SUPERUSER=1 # not that important but it clears the root user request log from composer
yes | composer install
php artisan migrate --force --seed
php artisan queue:restart
chmod -R 775 storage/* bootstrap/cache
chown -R $USER:www-data .
php artisan up
php artisan optimize
echo "Success! Your application is now up-to-date."