@@ -649,56 +649,56 @@ mkdir nginx apache2 php vsftpd proftpd bind exim4 dovecot clamd
649649mkdir spamassassin mysql postgresql hestia
650650
651651# Backup nginx configuration
652- service nginx stop > /dev/null 2>&1
652+ systemctl stop nginx > /dev/null 2>&1
653653cp -r /etc/nginx/* $hst_backups /nginx > /dev/null 2>&1
654654
655655# Backup Apache configuration
656- service apache2 stop > /dev/null 2>&1
656+ systemctl stop apache2 > /dev/null 2>&1
657657cp -r /etc/apache2/* $hst_backups /apache2 > /dev/null 2>&1
658658rm -f /etc/apache2/conf.d/* > /dev/null 2>&1
659659
660660# Backup PHP-FPM configuration
661- service php* -fpm stop > /dev/null 2>&1
661+ systemctl stop php* -fpm > /dev/null 2>&1
662662cp -r /etc/php/* $hst_backups /php/ > /dev/null 2>&1
663663
664664# Backup Bind configuration
665- service bind9 stop > /dev/null 2>&1
665+ systemctl stop bind9 > /dev/null 2>&1
666666cp -r /etc/bind/* $hst_backups /bind > /dev/null 2>&1
667667
668668# Backup Vsftpd configuration
669- service vsftpd stop > /dev/null 2>&1
669+ systemctl stop vsftpd > /dev/null 2>&1
670670cp /etc/vsftpd.conf $hst_backups /vsftpd > /dev/null 2>&1
671671
672672# Backup ProFTPD configuration
673- service proftpd stop > /dev/null 2>&1
673+ systemctl stop proftpd > /dev/null 2>&1
674674cp /etc/proftpd.conf $hst_backups /proftpd > /dev/null 2>&1
675675
676676# Backup Exim configuration
677- service exim4 stop > /dev/null 2>&1
677+ systemctl stop exim4 > /dev/null 2>&1
678678cp -r /etc/exim4/* $hst_backups /exim4 > /dev/null 2>&1
679679
680680# Backup ClamAV configuration
681- service clamav-daemon stop > /dev/null 2>&1
681+ systemctl stop clamav-daemon > /dev/null 2>&1
682682cp -r /etc/clamav/* $hst_backups /clamav > /dev/null 2>&1
683683
684684# Backup SpamAssassin configuration
685- service spamassassin stop > /dev/null 2>&1
685+ systemctl stop spamassassin > /dev/null 2>&1
686686cp -r /etc/spamassassin/* $hst_backups /spamassassin > /dev/null 2>&1
687687
688688# Backup Dovecot configuration
689- service dovecot stop > /dev/null 2>&1
689+ systemctl stop dovecot > /dev/null 2>&1
690690cp /etc/dovecot.conf $hst_backups /dovecot > /dev/null 2>&1
691691cp -r /etc/dovecot/* $hst_backups /dovecot > /dev/null 2>&1
692692
693693# Backup MySQL/MariaDB configuration and data
694- service mysql stop > /dev/null 2>&1
694+ systemctl stop mysql > /dev/null 2>&1
695695killall -9 mysqld > /dev/null 2>&1
696696mv /var/lib/mysql $hst_backups /mysql/mysql_datadir > /dev/null 2>&1
697697cp -r /etc/mysql/* $hst_backups /mysql > /dev/null 2>&1
698698mv -f /root/.my.cnf $hst_backups /mysql > /dev/null 2>&1
699699
700700# Backup Hestia
701- service hestia stop > /dev/null 2>&1
701+ systemctl stop hestia > /dev/null 2>&1
702702cp -r $HESTIA /* $hst_backups /hestia > /dev/null 2>&1
703703apt-get -y purge hestia hestia-nginx hestia-php > /dev/null 2>&1
704704rm -rf $HESTIA > /dev/null 2>&1
@@ -932,7 +932,7 @@ if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
932932fi
933933
934934# Restart SSH daemon
935- service ssh restart
935+ systemctl restart ssh
936936
937937# Disable AWStats cron
938938rm -f /etc/cron.d/awstats
@@ -1179,7 +1179,7 @@ if [ "$nginx" = 'yes' ]; then
11791179 ln -s $HESTIA /data/templates/web/nginx/PHP-$fpm_tpl .sh $HESTIA /data/templates/web/nginx/default.sh
11801180 ln -s $HESTIA /data/templates/web/nginx/PHP-$fpm_tpl .tpl $HESTIA /data/templates/web/nginx/default.tpl
11811181 ln -s $HESTIA /data/templates/web/nginx/PHP-$fpm_tpl .stpl $HESTIA /data/templates/web/nginx/default.stpl
1182- service php$fpm_v -fpm start >> $LOG
1182+ systemctl start php$fpm_v -fpm >> $LOG
11831183 check_result $? " php$fpm_v -fpm start failed"
11841184 fi
11851185
@@ -1199,7 +1199,7 @@ if [ "$nginx" = 'yes' ]; then
11991199 fi
12001200
12011201 update-rc.d nginx defaults > /dev/null 2>&1
1202- service nginx start >> $LOG
1202+ systemctl start nginx >> $LOG
12031203 check_result $? " nginx start failed"
12041204fi
12051205
@@ -1248,11 +1248,11 @@ if [ "$apache" = 'yes' ]; then
12481248 fi
12491249
12501250 update-rc.d apache2 defaults > /dev/null 2>&1
1251- service apache2 start >> $LOG
1251+ systemctl start apache2 >> $LOG
12521252 check_result $? " apache2 start failed"
12531253else
12541254 update-rc.d apache2 disable > /dev/null 2>&1
1255- service apache2 stop > /dev/null 2>&1
1255+ systemctl start apache2 > /dev/null 2>&1
12561256fi
12571257
12581258
@@ -1264,7 +1264,7 @@ if [ "$phpfpm" = 'yes' ]; then
12641264 echo " (*) Configuring PHP-FPM..."
12651265 cp -f $hestiacp /php-fpm/www.conf /etc/php/$fpm_v /fpm/pool.d/www.conf
12661266 update-rc.d php$fpm_v -fpm defaults > /dev/null 2>&1
1267- service php$fpm_v -fpm start >> $LOG
1267+ systemctl start php$fpm_v -fpm >> $LOG
12681268 check_result $? " php-fpm start failed"
12691269fi
12701270
@@ -1304,7 +1304,7 @@ if [ "$vsftpd" = 'yes' ]; then
13041304 chown root:adm /var/log/xferlog
13051305 chmod 640 /var/log/xferlog
13061306 update-rc.d vsftpd defaults
1307- service vsftpd start
1307+ systemctl start vsftpd
13081308 check_result $? " vsftpd start failed"
13091309
13101310fi
@@ -1319,7 +1319,7 @@ if [ "$proftpd" = 'yes' ]; then
13191319 echo " 127.0.0.1 $servername " >> /etc/hosts
13201320 cp -f $hestiacp /proftpd/proftpd.conf /etc/proftpd/
13211321 update-rc.d proftpd defaults > /dev/null 2>&1
1322- service proftpd start >> $LOG
1322+ systemctl start proftpd >> $LOG
13231323 check_result $? " proftpd start failed"
13241324fi
13251325
@@ -1343,7 +1343,7 @@ if [ "$mysql" = 'yes' ]; then
13431343 mysql_install_db >> $LOG
13441344
13451345 update-rc.d mysql defaults > /dev/null 2>&1
1346- service mysql start >> $LOG
1346+ systemctl start mysql >> $LOG
13471347 check_result $? " mariadb start failed"
13481348
13491349 # Securing MariaDB installation
@@ -1411,7 +1411,7 @@ if [ "$postgresql" = 'yes' ]; then
14111411 echo " (*) Configuring PostgreSQL database server..."
14121412 ppass=$( gen_pass)
14131413 cp -f $hestiacp /postgresql/pg_hba.conf /etc/postgresql/* /main/
1414- service postgresql restart
1414+ systemctl restart postgresql
14151415 sudo -u postgres psql -c " ALTER USER postgres WITH PASSWORD '$ppass '"
14161416
14171417 # Configuring phpPgAdmin
@@ -1438,13 +1438,13 @@ if [ "$named" = 'yes' ]; then
14381438 aa-complain /usr/sbin/named 2> /dev/null
14391439 if [ " $apparmor " = ' yes' ]; then
14401440 echo " /home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
1441- service apparmor status > /dev/null 2>&1
1441+ systemctl status apparmor > /dev/null 2>&1
14421442 if [ $? -ne 0 ]; then
1443- service apparmor restart
1443+ systemctl restart apparmor
14441444 fi
14451445 fi
14461446 update-rc.d bind9 defaults
1447- service bind9 start
1447+ systemctl start bind9
14481448 check_result $? " bind9 start failed"
14491449
14501450 # Workaround for OpenVZ/Virtuozzo
@@ -1480,12 +1480,11 @@ if [ "$exim" = 'yes' ]; then
14801480 rm -f /etc/alternatives/mta
14811481 ln -s /usr/sbin/exim4 /etc/alternatives/mta
14821482 update-rc.d -f sendmail remove > /dev/null 2>&1
1483- service sendmail stop > /dev/null 2>&1
1483+ systemctl stop sendmail > /dev/null 2>&1
14841484 update-rc.d -f postfix remove > /dev/null 2>&1
1485- service postfix stop > /dev/null 2>&1
1486-
1485+ systemctl stop postfix > /dev/null 2>&1
14871486 update-rc.d exim4 defaults
1488- service exim4 start
1487+ systemctl start exim4
14891488 check_result $? " exim4 start failed"
14901489fi
14911490
@@ -1504,7 +1503,7 @@ if [ "$dovecot" = 'yes' ]; then
15041503 rm -f /etc/dovecot/conf.d/15-mailboxes.conf
15051504 fi
15061505 update-rc.d dovecot defaults
1507- service dovecot start
1506+ systemctl start dovecot
15081507 check_result $? " dovecot start failed"
15091508fi
15101509
@@ -1538,7 +1537,7 @@ if [ "$clamd" = 'yes' ]; then
15381537 sleep 0.5
15391538 done
15401539 echo
1541- service clamav-daemon start
1540+ systemctl start clamav-daemon
15421541 check_result $? " clamav-daemon start failed"
15431542fi
15441543
@@ -1551,7 +1550,7 @@ if [ "$spamd" = 'yes' ]; then
15511550 echo " (*) Configuring SpamAssassin..."
15521551 update-rc.d spamassassin defaults > /dev/null 2>&1
15531552 sed -i " s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
1554- service spamassassin start >> $LOG
1553+ systemctl start spamassassin >> $LOG
15551554 check_result $? " spamassassin start failed"
15561555 unit_files=" $( systemctl list-unit-files | grep spamassassin) "
15571556 if [[ " $unit_files " =~ " disabled" ]]; then
@@ -1622,10 +1621,10 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
16221621
16231622 # Restart services
16241623 if [ " $apache " = ' yes' ]; then
1625- service apache2 restart
1624+ systemctl restart apache2
16261625 fi
16271626 if [ " $nginx " = ' yes' ]; then
1628- service nginx restart
1627+ systemctl restart nginx
16291628 fi
16301629fi
16311630
@@ -1663,7 +1662,7 @@ if [ "$fail2ban" = 'yes' ]; then
16631662 chown root:adm /var/log/auth.log
16641663 fi
16651664 update-rc.d fail2ban defaults
1666- service fail2ban start
1665+ systemctl start fail2ban
16671666 check_result $? " fail2ban start failed"
16681667fi
16691668
@@ -1762,7 +1761,7 @@ if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
17621761 echo " </IfModule>" >> remoteip.conf
17631762 sed -i " s/LogFormat \" %h/LogFormat \" %a/g" /etc/apache2/apache2.conf
17641763 a2enmod remoteip >> $LOG
1765- service apache2 restart
1764+ systemctl restart apache2
17661765fi
17671766
17681767# Configuring MariaDB host
@@ -1797,7 +1796,7 @@ $HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
17971796
17981797# Enable automatic updates
17991798$HESTIA /bin/v-add-cron-hestia-autoupdate
1800- service cron restart
1799+ systemctl restart cron
18011800
18021801# Building initital rrd images
18031802$HESTIA /bin/v-update-sys-rrd
@@ -1815,7 +1814,7 @@ $HESTIA/bin/v-change-sys-theme default
18151814
18161815# Starting Hestia service
18171816update-rc.d hestia defaults
1818- service hestia start
1817+ systemctl start hestia
18191818check_result $? " hestia start failed"
18201819chown admin:admin $HESTIA /data/sessions
18211820
0 commit comments