11#! /bin/bash
2+
23# Vesta installer v.03
34
45# ----------------------------------------------------------#
412413# Configure system #
413414# ----------------------------------------------------------#
414415
416+ # Set writable permission on tmp directory
417+ chmod 777 /tmp
418+
415419# Disabling SELinux
416420if [ -e ' /etc/sysconfig/selinux' ]; then
417421 sed -i ' s/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
@@ -472,6 +476,10 @@ chmod 640 /var/log/httpd/suexec.log
472476chmod 751 /var/log/httpd/domains
473477chkconfig httpd on
474478service httpd start
479+ if [ " $? " -ne 0 ]; then
480+ echo " Error: httpd start failed"
481+ exit
482+ fi
475483
476484# Nginx configuration
477485wget $CHOST /$VERSION /nginx.conf -O /etc/nginx/nginx.conf
@@ -482,21 +490,34 @@ rm -f /etc/nginx/conf.d/vesta_users.conf
482490touch /etc/nginx/conf.d/vesta_users.conf
483491chkconfig nginx on
484492service nginx start
493+ if [ " $? " -ne 0 ]; then
494+ echo " Error: nginx start failed"
495+ exit
496+ fi
485497
486498# Vsftpd configuration
487499wget $CHOST /$VERSION /vsftpd.conf -O /etc/vsftpd/vsftpd.conf
488500chkconfig vsftpd on
489501service vsftpd start
502+ if [ " $? " -ne 0 ]; then
503+ echo " Error: vsftpd start failed"
504+ exit
505+ fi
490506
491507# MySQL configuration
492508mpass=$( gen_pass)
493- if [ " $srv_type " = ' micro' ]; then
509+ if [ " $srv_type " = ' micro' ]; then
494510 wget $CHOST /$VERSION /mysql-512.cnf -O /etc/my.cnf
495511else
496512 wget $CHOST /$VERSION /mysql.cnf -O /etc/my.cnf
497513fi
498514chkconfig mysqld on
499515service mysqld start
516+ if [ " $? " -ne 0 ]; then
517+ echo " Error: mysqld start failed"
518+ exit
519+ fi
520+
500521mysqladmin -u root password $mpass
501522echo -e " [client]\npassword='$mpass '\n" > /root/.my.cnf
502523
@@ -506,6 +527,10 @@ chown root:named /etc/named.conf
506527chmod 640 /etc/named.conf
507528chkconfig named on
508529service named start
530+ if [ " $? " -ne 0 ]; then
531+ echo " Error: named start failed"
532+ exit
533+ fi
509534
510535# Exim
511536wget $CHOST /$VERSION /exim.conf -O /etc/exim/exim.conf
@@ -532,6 +557,10 @@ rm -f /etc/alternatives/mta
532557ln -s /usr/sbin/sendmail.exim /etc/alternatives/mta
533558chkconfig exim on
534559service exim start
560+ if [ " $? " -ne 0 ]; then
561+ echo " Error: exim start failed"
562+ exit
563+ fi
535564
536565# Dovecot configuration
537566if [ " $release " -eq ' 5' ]; then
547576gpasswd -a dovecot mail
548577chkconfig dovecot on
549578service dovecot start
579+ if [ " $? " -ne 0 ]; then
580+ echo " Error: dovecot start failed"
581+ exit
582+ fi
550583
551584# ClamAV configuration
552585if [ " $srv_type " = ' medium' ] || [ " $srv_type " = ' large' ]; then
@@ -557,12 +590,22 @@ if [ "$srv_type" = 'medium' ] || [ "$srv_type" = 'large' ]; then
557590 /usr/bin/freshclam
558591 chkconfig clamd on
559592 service clamd start
593+ if [ " $? " -ne 0 ]; then
594+ echo " Error: clamd start failed"
595+ exit
596+ fi
597+
560598fi
561599
562600# SpamAssassin configuration
563601if [ " $srv_type " = ' medium' ] || [ " $srv_type " = ' large' ]; then
564602 chkconfig spamassassin on
565603 service spamassassin start
604+ if [ " $? " -ne 0 ]; then
605+ echo " Error: spamassassin start failed"
606+ exit
607+ fi
608+
566609fi
567610
568611# php configuration
@@ -712,6 +755,10 @@ $VESTA/bin/v-update-sys-rrd
712755# Start system service
713756chkconfig vesta on
714757service vesta start
758+ if [ " $? " -ne 0 ]; then
759+ echo " Error: vesta start failed"
760+ exit
761+ fi
715762
716763# Send notification to vestacp.com
717764wget vestacp.com/notify/? $REPO -O /dev/null
0 commit comments