Skip to content

Commit 047e1c1

Browse files
author
Kristan Kenney
committed
Improve upgrade script service detection logic
1 parent 98a5277 commit 047e1c1

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

install/upgrade/0.10.0-190430.sh

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ if [ -d $HESTIA/data/templates/ ]; then
117117
cp -rf $HESTIA/data/templates $HESTIA_BACKUP/templates/
118118
$HESTIA/bin/v-update-web-templates
119119
$HESTIA/bin/v-update-dns-templates
120-
$HESTIA/bin/v-update-mail-templates
120+
$HESTIA/bin/v-update-mail-templates
121121
fi
122122

123123
# Remove old Office 365 template as there is a newer version with an updated name
@@ -172,7 +172,7 @@ if [ -d "/etc/roundcube" ]; then
172172
fi
173173

174174
# Check if acl package is installed
175-
echo "(*) Verify acl package and hardening user permissions..."
175+
echo "(*) Verifying ACLs and hardening user permissions..."
176176
if [ ! -e '/usr/bin/setfacl' ]; then
177177
apt-get -qq update > /dev/null 2>&1
178178
apt-get -qq -y install acl > /dev/null 2>&1
@@ -348,21 +348,37 @@ done
348348
# Rebuild user
349349
for user in `ls /usr/local/hestia/data/users/`; do
350350
echo "(*) Rebuilding domains and account for user: $user..."
351-
v-rebuild-web-domains $user >/dev/null 2>&1
352-
v-rebuild-dns-domains $user >/dev/null 2>&1
353-
v-rebuild-mail-domains $user >/dev/null 2>&1
351+
if [ ! -z $WEB_SYSTEM ]; then
352+
v-rebuild-web-domains $user >/dev/null 2>&1
353+
fi
354+
if [ ! -z $DNS_SYSTEM ]; then
355+
v-rebuild-dns-domains $user >/dev/null 2>&1
356+
fi
357+
if [ ! -z $MAIL_SYSTEM ]; then
358+
v-rebuild-mail-domains $user >/dev/null 2>&1
359+
fi
354360
done
355361

356-
# Adding upgrade notification
362+
# Add upgrade notification to admin user's panel
357363
$BIN/v-add-user-notification admin 'Upgrade complete' 'Your server has been updated to v0.10.0.<br>Please report any bugs on GitHub at<br>https://github.com/hestiacp/hestiacp/Issues<br><br>Have a great day!'
358-
# Restart server services
364+
365+
# Restart services for changes to take full effect
359366
echo "(*) Restarting services..."
360-
sleep 5
361-
$BIN/v-restart-mail $restart
362-
$BIN/v-restart-service $IMAP_SYSTEM $restart
363-
$BIN/v-restart-web $restart
364-
$BIN/v-restart-proxy $restart
365-
$BIN/v-restart-dns $restart
367+
sleep 3
368+
if [ ! -z $MAIL_SYSTEM ]; then
369+
$BIN/v-restart-mail $restart
370+
fi
371+
if [ ! -z $IMAP_SYSTEM ]; then
372+
$BIN/v-restart-service $IMAP_SYSTEM $restart
373+
fi
374+
if [ ! -z $WEB_SYSTEM ]; then
375+
$BIN/v-restart-web $restart
376+
$BIN/v-restart-proxy $restart
377+
fi
378+
if [ ! -z $DNS_SYSTEM ]; then
379+
$BIN/v-restart-dns $restart
380+
fi
381+
366382

367383
echo ""
368384
echo " Upgrade complete! Please report any bugs or issues to"

0 commit comments

Comments
 (0)