@@ -609,56 +609,56 @@ mkdir nginx apache2 php vsftpd proftpd bind exim4 dovecot clamd
609609mkdir spamassassin mysql postgresql hestia
610610
611611# Backup nginx configuration
612- service nginx stop > /dev/null 2>&1
612+ systemctl stop nginx > /dev/null 2>&1
613613cp -r /etc/nginx/* $hst_backups /nginx > /dev/null 2>&1
614614
615615# Backup Apache configuration
616- service apache2 stop > /dev/null 2>&1
616+ systemctl stop apache2 > /dev/null 2>&1
617617cp -r /etc/apache2/* $hst_backups /apache2 > /dev/null 2>&1
618618rm -f /etc/apache2/conf.d/* > /dev/null 2>&1
619619
620620# Backup PHP-FPM configuration
621- service php* -fpm stop > /dev/null 2>&1
621+ systemctl stop php* -fpm > /dev/null 2>&1
622622cp -r /etc/php/* $hst_backups /php/ > /dev/null 2>&1
623623
624624# Backup Bind configuration
625- service bind9 stop > /dev/null 2>&1
625+ systemctl stop bind9 > /dev/null 2>&1
626626cp -r /etc/bind/* $hst_backups /bind > /dev/null 2>&1
627627
628628# Backup Vsftpd configuration
629- service vsftpd stop > /dev/null 2>&1
629+ systemctl stop vsftpd > /dev/null 2>&1
630630cp /etc/vsftpd.conf $hst_backups /vsftpd > /dev/null 2>&1
631631
632632# Backup ProFTPD configuration
633- service proftpd stop > /dev/null 2>&1
633+ systemctl stop proftpd > /dev/null 2>&1
634634cp /etc/proftpd.conf $hst_backups /proftpd > /dev/null 2>&1
635635
636636# Backup Exim configuration
637- service exim4 stop > /dev/null 2>&1
637+ systemctl stop exim4 > /dev/null 2>&1
638638cp -r /etc/exim4/* $hst_backups /exim4 > /dev/null 2>&1
639639
640640# Backup ClamAV configuration
641- service clamav-daemon stop > /dev/null 2>&1
641+ systemctl stop clamav-daemon > /dev/null 2>&1
642642cp -r /etc/clamav/* $hst_backups /clamav > /dev/null 2>&1
643643
644644# Backup SpamAssassin configuration
645- service spamassassin stop > /dev/null 2>&1
645+ systemctl stop spamassassin > /dev/null 2>&1
646646cp -r /etc/spamassassin/* $hst_backups /spamassassin > /dev/null 2>&1
647647
648648# Backup Dovecot configuration
649- service dovecot stop > /dev/null 2>&1
649+ systemctl stop dovecot > /dev/null 2>&1
650650cp /etc/dovecot.conf $hst_backups /dovecot > /dev/null 2>&1
651651cp -r /etc/dovecot/* $hst_backups /dovecot > /dev/null 2>&1
652652
653653# Backup MySQL/MariaDB configuration and data
654- service mysql stop > /dev/null 2>&1
654+ systemctl stop mysql > /dev/null 2>&1
655655killall -9 mysqld > /dev/null 2>&1
656656mv /var/lib/mysql $hst_backups /mysql/mysql_datadir > /dev/null 2>&1
657657cp -r /etc/mysql/* $hst_backups /mysql > /dev/null 2>&1
658658mv -f /root/.my.cnf $hst_backups /mysql > /dev/null 2>&1
659659
660660# Backup Hestia
661- service hestia stop > /dev/null 2>&1
661+ systemctl stop hestia > /dev/null 2>&1
662662cp -r $HESTIA /* $hst_backups /hestia > /dev/null 2>&1
663663apt-get -y purge hestia hestia-nginx hestia-php > /dev/null 2>&1
664664rm -rf $HESTIA > /dev/null 2>&1
@@ -904,7 +904,7 @@ if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
904904fi
905905
906906# Restart SSH daemon
907- service ssh restart
907+ systemctl restart ssh
908908
909909# Disable AWStats cron
910910rm -f /etc/cron.d/awstats
@@ -1142,7 +1142,7 @@ if [ "$nginx" = 'yes' ]; then
11421142 ln -s $HESTIA /data/templates/web/nginx/PHP-$fpm_tpl .sh $HESTIA /data/templates/web/nginx/default.sh
11431143 ln -s $HESTIA /data/templates/web/nginx/PHP-$fpm_tpl .tpl $HESTIA /data/templates/web/nginx/default.tpl
11441144 ln -s $HESTIA /data/templates/web/nginx/PHP-$fpm_tpl .stpl $HESTIA /data/templates/web/nginx/default.stpl
1145- service php$fpm_v -fpm start >> $LOG
1145+ systemctl start php$fpm_v -fpm>> $LOG
11461146 check_result $? " php$fpm_v -fpm start failed"
11471147 fi
11481148
@@ -1161,7 +1161,7 @@ if [ "$nginx" = 'yes' ]; then
11611161 fi
11621162
11631163 update-rc.d nginx defaults > /dev/null 2>&1
1164- service nginx start >> $LOG
1164+ systemctl start nginx >> $LOG
11651165 check_result $? " nginx start failed"
11661166fi
11671167
@@ -1206,11 +1206,11 @@ if [ "$apache" = 'yes' ]; then
12061206 fi
12071207
12081208 update-rc.d apache2 defaults > /dev/null 2>&1
1209- service apache2 start >> $LOG
1209+ systemctl start apache2 >> $LOG
12101210 check_result $? " apache2 start failed"
12111211else
12121212 update-rc.d apache2 disable > /dev/null 2>&1
1213- service apache2 stop > /dev/null 2>&1
1213+ systemctl stop apache2 > /dev/null 2>&1
12141214fi
12151215
12161216
@@ -1222,7 +1222,7 @@ if [ "$phpfpm" = 'yes' ]; then
12221222 echo " (*) Configuring PHP-FPM..."
12231223 cp -f $hestiacp /php-fpm/www.conf /etc/php/$fpm_v /fpm/pool.d/www.conf
12241224 update-rc.d php$fpm_v -fpm defaults > /dev/null 2>&1
1225- service php$fpm_v -fpm start >> $LOG
1225+ systemctl start php$fpm_v -fpm >> $LOG
12261226 check_result $? " php-fpm start failed"
12271227fi
12281228
@@ -1262,7 +1262,7 @@ if [ "$vsftpd" = 'yes' ]; then
12621262 chown root:adm /var/log/xferlog
12631263 chmod 640 /var/log/xferlog
12641264 update-rc.d vsftpd defaults
1265- service vsftpd start
1265+ systemctl start vsftpd >> $LOG
12661266 check_result $? " vsftpd start failed"
12671267
12681268fi
@@ -1277,7 +1277,7 @@ if [ "$proftpd" = 'yes' ]; then
12771277 echo " 127.0.0.1 $servername " >> /etc/hosts
12781278 cp -f $hestiacp /proftpd/proftpd.conf /etc/proftpd/
12791279 update-rc.d proftpd defaults > /dev/null 2>&1
1280- service proftpd start >> $LOG
1280+ systemctl start proftpd >> $LOG
12811281 check_result $? " proftpd start failed"
12821282fi
12831283
@@ -1301,7 +1301,7 @@ if [ "$mysql" = 'yes' ]; then
13011301 mysql_install_db >> $LOG
13021302
13031303 update-rc.d mysql defaults > /dev/null 2>&1
1304- service mysql start >> $LOG
1304+ systemctl start mysql >> $LOG
13051305 check_result $? " mariadb start failed"
13061306
13071307 # Securing MariaDB installation
@@ -1369,7 +1369,7 @@ if [ "$postgresql" = 'yes' ]; then
13691369 echo " (*) Configuring PostgreSQL database server..."
13701370 ppass=$( gen_pass)
13711371 cp -f $hestiacp /postgresql/pg_hba.conf /etc/postgresql/* /main/
1372- service postgresql restart
1372+ systemctl restart postgresql
13731373 sudo -u postgres psql -c " ALTER USER postgres WITH PASSWORD '$ppass '"
13741374
13751375 # Configuring phpPgAdmin
@@ -1398,11 +1398,11 @@ if [ "$named" = 'yes' ]; then
13981398 if ! grep --quiet lxc /proc/1/environ; then
13991399 service apparmor status > /dev/null 2>&1
14001400 if [ $? -ne 0 ]; then
1401- service apparmor restart
1401+ systemctl restart apparmor >> $LOG
14021402 fi
14031403 fi
14041404 update-rc.d bind9 defaults
1405- service bind9 start
1405+ systemctl start bind9
14061406 check_result $? " bind9 start failed"
14071407
14081408 # Workaround for OpenVZ/Virtuozzo
@@ -1438,12 +1438,12 @@ if [ "$exim" = 'yes' ]; then
14381438 rm -f /etc/alternatives/mta
14391439 ln -s /usr/sbin/exim4 /etc/alternatives/mta
14401440 update-rc.d -f sendmail remove > /dev/null 2>&1
1441- service sendmail stop > /dev/null 2>&1
1441+ systemctl stop sendmail > /dev/null 2>&1
14421442 update-rc.d -f postfix remove > /dev/null 2>&1
1443- service postfix stop > /dev/null 2>&1
1443+ systemctl stop postfix > /dev/null 2>&1
14441444
14451445 update-rc.d exim4 defaults
1446- service exim4 start
1446+ systemctl start exim4 >> $LOG
14471447 check_result $? " exim4 start failed"
14481448fi
14491449
@@ -1462,7 +1462,7 @@ if [ "$dovecot" = 'yes' ]; then
14621462 fi
14631463 chown -R root:root /etc/dovecot*
14641464 update-rc.d dovecot defaults
1465- service dovecot start
1465+ systemctl start dovecot >> $LOG
14661466 check_result $? " dovecot start failed"
14671467fi
14681468
@@ -1485,7 +1485,7 @@ if [ "$clamd" = 'yes' ]; then
14851485 sleep 0.5
14861486 done
14871487 echo
1488- service clamav-daemon start
1488+ systemctl start clamav-daemon >> $LOG
14891489 check_result $? " clamav-daemon start failed"
14901490fi
14911491
@@ -1498,7 +1498,7 @@ if [ "$spamd" = 'yes' ]; then
14981498 echo " (*) Configuring SpamAssassin..."
14991499 update-rc.d spamassassin defaults > /dev/null 2>&1
15001500 sed -i " s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
1501- service spamassassin start >> $LOG
1501+ systemctl start spamassassin >> $LOG
15021502 check_result $? " spamassassin start failed"
15031503 unit_files=" $( systemctl list-unit-files | grep spamassassin) "
15041504 if [[ " $unit_files " =~ " disabled" ]]; then
@@ -1547,10 +1547,10 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
15471547
15481548 # Restart services
15491549 if [ " $apache " = ' yes' ]; then
1550- service apache2 restart
1550+ systemctl restart apache2 >> $LOG
15511551 fi
15521552 if [ " $nginx " = ' yes' ]; then
1553- service nginx restart
1553+ systemctl restart nginx >> $LOG
15541554 fi
15551555fi
15561556
@@ -1582,7 +1582,7 @@ if [ "$fail2ban" = 'yes' ]; then
15821582 sed -i " ${fline} s/false/true/" /etc/fail2ban/jail.local
15831583 fi
15841584 update-rc.d fail2ban defaults
1585- service fail2ban start
1585+ systemctl start fail2ban >> $LOG
15861586 check_result $? " fail2ban start failed"
15871587fi
15881588
@@ -1687,7 +1687,7 @@ $HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
16871687
16881688# Enable automatic updates
16891689$HESTIA /bin/v-add-cron-hestia-autoupdate
1690- service cron restart
1690+ systemctl restart cron
16911691
16921692# Building initital rrd images
16931693$HESTIA /bin/v-update-sys-rrd
@@ -1702,7 +1702,7 @@ $HESTIA/bin/v-change-sys-port $port
17021702
17031703# Starting Hestia service
17041704update-rc.d hestia defaults
1705- service hestia start
1705+ systemctl start hestia
17061706check_result $? " hestia start failed"
17071707chown admin:admin $HESTIA /data/sessions
17081708
0 commit comments