Skip to content

Commit 844b21b

Browse files
committed
Add additional logging function to installer scripts.
1 parent 20de29a commit 844b21b

File tree

2 files changed

+54
-46
lines changed

2 files changed

+54
-46
lines changed

install/hst-install-debian.sh

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RHOST='apt.hestiacp.com'
1111
GPG='gpg.hestiacp.com'
1212
VERSION='debian'
1313
HESTIA='/usr/local/hestia'
14+
LOG="/root/hst_install_backups/$(date +%s).log"
1415
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
1516
arch=$(uname -i)
1617
os='debian'
@@ -274,28 +275,28 @@ apt-get -qq update
274275
# Checking wget
275276
if [ ! -e '/usr/bin/wget' ]; then
276277
echo "Install missing wget..."
277-
apt-get -y install wget > /dev/null 2>&1
278+
apt-get -y install wget >> $LOG
278279
check_result $? "Can't install wget"
279280
fi
280281

281282
# Checking dirmngr
282283
if [ ! -e '/usr/bin/dirmngr' ]; then
283284
echo "Install missing dirmngr..."
284-
apt-get -y install dirmngr > /dev/null 2>&1
285+
apt-get -y install dirmngr >> $LOG
285286
check_result $? "Can't install dirmngr"
286287
fi
287288

288289
# Checking screen
289290
if [ ! -e '/usr/bin/screen' ]; then
290291
echo "Install missing screen..."
291-
apt-get -y install screen > /dev/null 2>&1
292+
apt-get -y install screen >> $LOG
292293
check_result $? "Can't install screen"
293294
fi
294295

295296
# Check if apt-transport-https is installed
296297
if [ ! -e '/usr/lib/apt/methods/https' ]; then
297298
echo "Install missing apt-transport-https..."
298-
apt-get -y install apt-transport-https > /dev/null 2>&1
299+
apt-get -y install apt-transport-https >> $LOG
299300
check_result $? "Can't install apt-transport-https"
300301
fi
301302

@@ -468,6 +469,9 @@ fi
468469
hst_backups="/root/hst_install_backups/$(date +%s)"
469470
echo "Installation backup directory: $hst_backups"
470471

472+
# Print Log File Path
473+
echo "Installation Log File: $LOG"
474+
471475
# Printing start message and sleeping for 2 seconds
472476
echo -e "\n\nWe will now install HestiaCP and all required packages. The process will take around 10-15 minutes...\n"
473477
sleep 2
@@ -493,7 +497,7 @@ fi
493497

494498
# Updating system
495499
echo "Upgrade System using apt-get..."
496-
apt-get -y upgrade > /dev/null 2>&1
500+
apt-get -y upgrade >> $LOG
497501
check_result $? 'apt-get upgrade failed'
498502

499503
# Define apt conf location
@@ -503,13 +507,13 @@ apt=/etc/apt/sources.list.d
503507
echo "deb http://nginx.org/packages/mainline/$VERSION/ $codename nginx" \
504508
> $apt/nginx.list
505509
wget --quiet http://nginx.org/keys/nginx_signing.key -O /tmp/nginx_signing.key
506-
apt-key add /tmp/nginx_signing.key > /dev/null 2>&1
510+
apt-key add /tmp/nginx_signing.key >> $LOG
507511

508512
if [ "$multiphp" = 'yes' ] || [ "$phpfpm" = 'yes' ]; then
509513
# Installing sury php repo
510514
echo "deb https://packages.sury.org/php/ $codename main" > $apt/php.list
511-
wget https://packages.sury.org/php/apt.gpg -O /tmp/php_signing.key > /dev/null 2>&1
512-
apt-key add /tmp/php_signing.key > /dev/null 2>&1
515+
wget https://packages.sury.org/php/apt.gpg -O /tmp/php_signing.key >> $LOG
516+
apt-key add /tmp/php_signing.key >> $LOG
513517
fi
514518

515519
# Installing MariaDB repo
@@ -519,7 +523,7 @@ screen -dm apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C7
519523
# Installing hestia repo
520524
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
521525
wget --quiet https://gpg.hestiacp.com/deb_signing.key -O /tmp/deb_signing.key
522-
apt-key add /tmp/deb_signing.key > /dev/null 2>&1
526+
apt-key add /tmp/deb_signing.key >> $LOG
523527

524528

525529
#----------------------------------------------------------#
@@ -697,7 +701,7 @@ echo -e '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d
697701
chmod a+x /usr/sbin/policy-rc.d
698702

699703
# Installing apt packages
700-
apt-get -y install $software > /dev/null 2>&1
704+
apt-get -y install $software >> $LOG
701705
check_result $? "apt-get install failed"
702706

703707
# Restoring autostart policy
@@ -948,11 +952,11 @@ if [ "$nginx" = 'yes' ]; then
948952
ln -s $HESTIA/data/templates/web/nginx/PHP-72.tpl $HESTIA/data/templates/web/nginx/default.tpl
949953
ln -s $HESTIA/data/templates/web/nginx/PHP-72.stpl $HESTIA/data/templates/web/nginx/default.stpl
950954
chmod a+x $HESTIA/data/templates/web/nginx/*.sh
951-
service php7.2-fpm start > /dev/null 2>&1
955+
service php7.2-fpm start >> $LOG
952956
check_result $? "php7.2-fpm start failed"
953957
fi
954958
update-rc.d nginx defaults > /dev/null 2>&1
955-
service nginx start > /dev/null 2>&1
959+
service nginx start >> $LOG
956960
check_result $? "nginx start failed"
957961
fi
958962

@@ -1011,7 +1015,7 @@ if [ "$apache" = 'yes' ]; then
10111015
fi
10121016
fi
10131017
update-rc.d apache2 defaults > /dev/null 2>&1
1014-
service apache2 start > /dev/null 2>&1
1018+
service apache2 start >> $LOG
10151019
check_result $? "apache2 start failed"
10161020
else
10171021
update-rc.d apache2 disable >/dev/null 2>&1
@@ -1026,7 +1030,7 @@ fi
10261030
if [ "$phpfpm" = 'yes' ]; then
10271031
cp -f $hestiacp/php-fpm/www.conf /etc/php/7.2/fpm/pool.d/www.conf
10281032
update-rc.d php7.2-fpm defaults > /dev/null 2>&1
1029-
service php7.2-fpm start > /dev/null 2>&1
1033+
service php7.2-fpm start >> $LOG
10301034
check_result $? "php-fpm start failed"
10311035
fi
10321036

@@ -1088,15 +1092,15 @@ if [ "$mysql" = 'yes' ]; then
10881092

10891093
# Configuring MariaDB
10901094
cp -f $hestiacp/mysql/$mycnf /etc/mysql/my.cnf
1091-
mysql_install_db > /dev/null 2>&1
1095+
mysql_install_db >> $LOG
10921096

10931097
update-rc.d mysql defaults
10941098
service mysql start
10951099
check_result $? "mariadb start failed"
10961100

10971101
# Securing MariaDB installation
10981102
mpass=$(gen_pass)
1099-
mysqladmin -u root password $mpass > /dev/null 2>&1
1103+
mysqladmin -u root password $mpass >> $LOG
11001104
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
11011105
chmod 600 /root/.my.cnf
11021106

@@ -1224,9 +1228,9 @@ if [ "$exim" = 'yes' ]; then
12241228
rm -f /etc/alternatives/mta
12251229
ln -s /usr/sbin/exim4 /etc/alternatives/mta
12261230
update-rc.d -f sendmail remove > /dev/null 2>&1
1227-
service sendmail stop > /dev/null 2>&1
1231+
service sendmail stop >> $LOG
12281232
update-rc.d -f postfix remove > /dev/null 2>&1
1229-
service postfix stop > /dev/null 2>&1
1233+
service postfix stop >> $LOG
12301234

12311235
update-rc.d exim4 defaults
12321236
service exim4 start
@@ -1273,7 +1277,7 @@ if [ "$clamd" = 'yes' ]; then
12731277
systemctl daemon-reload
12741278
fi
12751279
echo "Updating ClamAV..."
1276-
/usr/bin/freshclam > /dev/null 2>&1
1280+
/usr/bin/freshclam >> $LOG
12771281
service clamav-daemon start
12781282
check_result $? "clamav-daemon start failed"
12791283
fi
@@ -1286,7 +1290,7 @@ fi
12861290
if [ "$spamd" = 'yes' ]; then
12871291
update-rc.d spamassassin defaults > /dev/null 2>&1
12881292
sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
1289-
service spamassassin start > /dev/null 2>&1
1293+
service spamassassin start >> $LOG
12901294
check_result $? "spamassassin start failed"
12911295
unit_files="$(systemctl list-unit-files |grep spamassassin)"
12921296
if [[ "$unit_files" =~ "disabled" ]]; then
@@ -1412,7 +1416,7 @@ fi
14121416
# Special thanks to Pavel Galkin (https://skurudo.ru)
14131417
# https://github.com/skurudo/phpmyadmin-fixer
14141418

1415-
source $hestiacp/phpmyadmin/pma.sh > /dev/null 2>&1
1419+
source $hestiacp/phpmyadmin/pma.sh >> $LOG
14161420

14171421

14181422
#----------------------------------------------------------#
@@ -1481,7 +1485,7 @@ if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
14811485
fi
14821486
echo "</IfModule>" >> remoteip.conf
14831487
sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf
1484-
a2enmod remoteip > /dev/null 2>&1
1488+
a2enmod remoteip >> $LOG
14851489
service apache2 restart
14861490
fi
14871491

0 commit comments

Comments
 (0)