mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
call pm2 stop all only if there is something to stop
This commit is contained in:
parent
cb09c6b783
commit
a43df907c2
@ -152,6 +152,11 @@ log_error() {
|
||||
echo -e "\e[31m$message\e[0m" > /dev/tty # red in console
|
||||
echo "<span style="color:red">$message</span>" >> "$UPDATE_HTML" # red in html
|
||||
}
|
||||
log_warn() {
|
||||
local message="$1"
|
||||
echo -e "\e[33m$message\e[0m" > /dev/tty # yellow in console
|
||||
echo "<span style="color:yellow">$message</span>" >> "$UPDATE_HTML" # yellow in html
|
||||
}
|
||||
log_success() {
|
||||
local message="$1"
|
||||
echo -e "\e[32m$message\e[0m" > /dev/tty # green in console
|
||||
@ -165,16 +170,22 @@ onError() {
|
||||
log_error "( o.o ) Exit Code: $exit_code"
|
||||
log_error " > ^ < Offending command: '$BASH_COMMAND'"
|
||||
log_error ""
|
||||
cleanup
|
||||
exit 1
|
||||
}
|
||||
trap onError ERR
|
||||
|
||||
|
||||
# stop all services
|
||||
log_step "Stop and delete all Gradido services"
|
||||
pm2 delete all
|
||||
pm2 save
|
||||
# check if pm2 has processes, maybe it was already cleared from a failed update
|
||||
# pm2 delete all if pm2 has no processes will trigger error and stop script
|
||||
# so let's check first
|
||||
if [ "$(pm2 prettylist)" != "[]" ]; then
|
||||
pm2 delete all
|
||||
pm2 save
|
||||
else
|
||||
log_warn "PM2 is already empty"
|
||||
fi
|
||||
|
||||
|
||||
# git
|
||||
BRANCH=$1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user