-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
57 lines (40 loc) · 1.07 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
53
54
55
56
57
#!/bin/bash
function exe {
echo
echo "-----------"
echo "Execute: $@"
$@
local status=$?
if [[ $status != 0 ]]; then
echo "ERROR: command $@ exited with status $status"
exit 1
fi
}
who=`whoami`
echo "Please wait file getting diff..."
exe "git fetch"
branch=`git branch | awk '/^\*/{print $2}'`
echo "Branch detected: ${branch}"
echo "The following files are modified/will be changes by an update:"
exe "git --no-pager diff --name-status -R origin/${branch}"
pwd=`pwd`
echo "Hit enter to update ${pwd}?"
read
exe "php artisan down"
exe "git reset --hard"
exe "git pull --force"
exe "composer update"
exe "php artisan migrate --force"
exe "php artisan auth:clear-resets"
exe "php artisan config:clear"
exe "php artisan view:clear"
exe "chown -R www-data:www-data /var/www/html/*"
exe "npm install"
exe "npm run production"
exe "supervisorctl reload"
sleep 5
#exe "supervisorctl restart my-worker:*"
#exe "supervisord -c horizon.conf"
exe "chgrp -R www-data storage bootstrap/cache"
exe "chmod -R ug+rwx storage bootstrap/cache"
exe "php artisan up"