Skip to content

Commit 580e308

Browse files
committed
added return code verifications
1 parent 7113dd6 commit 580e308

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

install/vst-install.sh

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
# Vesta installer v.03
34

45
#----------------------------------------------------------#
@@ -412,6 +413,9 @@ fi
412413
# Configure system #
413414
#----------------------------------------------------------#
414415

416+
# Set writable permission on tmp directory
417+
chmod 777 /tmp
418+
415419
# Disabling SELinux
416420
if [ -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
472476
chmod 751 /var/log/httpd/domains
473477
chkconfig httpd on
474478
service httpd start
479+
if [ "$?" -ne 0 ]; then
480+
echo "Error: httpd start failed"
481+
exit
482+
fi
475483

476484
# Nginx configuration
477485
wget $CHOST/$VERSION/nginx.conf -O /etc/nginx/nginx.conf
@@ -482,21 +490,34 @@ rm -f /etc/nginx/conf.d/vesta_users.conf
482490
touch /etc/nginx/conf.d/vesta_users.conf
483491
chkconfig nginx on
484492
service nginx start
493+
if [ "$?" -ne 0 ]; then
494+
echo "Error: nginx start failed"
495+
exit
496+
fi
485497

486498
# Vsftpd configuration
487499
wget $CHOST/$VERSION/vsftpd.conf -O /etc/vsftpd/vsftpd.conf
488500
chkconfig vsftpd on
489501
service vsftpd start
502+
if [ "$?" -ne 0 ]; then
503+
echo "Error: vsftpd start failed"
504+
exit
505+
fi
490506

491507
# MySQL configuration
492508
mpass=$(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
495511
else
496512
wget $CHOST/$VERSION/mysql.cnf -O /etc/my.cnf
497513
fi
498514
chkconfig mysqld on
499515
service mysqld start
516+
if [ "$?" -ne 0 ]; then
517+
echo "Error: mysqld start failed"
518+
exit
519+
fi
520+
500521
mysqladmin -u root password $mpass
501522
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
502523

@@ -506,6 +527,10 @@ chown root:named /etc/named.conf
506527
chmod 640 /etc/named.conf
507528
chkconfig named on
508529
service named start
530+
if [ "$?" -ne 0 ]; then
531+
echo "Error: named start failed"
532+
exit
533+
fi
509534

510535
# Exim
511536
wget $CHOST/$VERSION/exim.conf -O /etc/exim/exim.conf
@@ -532,6 +557,10 @@ rm -f /etc/alternatives/mta
532557
ln -s /usr/sbin/sendmail.exim /etc/alternatives/mta
533558
chkconfig exim on
534559
service exim start
560+
if [ "$?" -ne 0 ]; then
561+
echo "Error: exim start failed"
562+
exit
563+
fi
535564

536565
# Dovecot configuration
537566
if [ "$release" -eq '5' ]; then
@@ -547,6 +576,10 @@ fi
547576
gpasswd -a dovecot mail
548577
chkconfig dovecot on
549578
service dovecot start
579+
if [ "$?" -ne 0 ]; then
580+
echo "Error: dovecot start failed"
581+
exit
582+
fi
550583

551584
# ClamAV configuration
552585
if [ "$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+
560598
fi
561599

562600
# SpamAssassin configuration
563601
if [ "$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+
566609
fi
567610

568611
# php configuration
@@ -712,6 +755,10 @@ $VESTA/bin/v-update-sys-rrd
712755
# Start system service
713756
chkconfig vesta on
714757
service vesta start
758+
if [ "$?" -ne 0 ]; then
759+
echo "Error: vesta start failed"
760+
exit
761+
fi
715762

716763
# Send notification to vestacp.com
717764
wget vestacp.com/notify/?$REPO -O /dev/null

0 commit comments

Comments
 (0)