5454 email=$( grep CONTACT $VESTA /data/users/admin/user.conf | cut -f 2 -d \' )
5555fi
5656if [ -e " $VESTA /web/inc/mail-wrapper.php" ]; then
57- mail =" $VESTA /web/inc/mail-wrapper.php"
57+ send_mail =" $VESTA /web/inc/mail-wrapper.php"
5858else
59- mail =$( which mail)
59+ send_mail =$( which mail)
6060fi
6161
6262# Check load average
@@ -67,7 +67,7 @@ while [ "$la" -ge "$BACKUP_LA_LIMIT" ]; do
6767 echo
6868 sleep 60
6969 if [ " $i " -ge " 15" ]; then
70- echo " LoadAverage $i is above threshold" | $mail -s " $subj " $email
70+ echo " LoadAverage $i is above threshold" | $send_mail -s " $subj " $email
7171 echo " Error: LA is too high"
7272 sed -i " / $user /d" $VESTA /data/queue/backup.pipe
7373 log_event " $E_LA " " $EVENT "
7979# Creating temporary directory
8080tmpdir=$( mktemp -p $BACKUP -d)
8181if [ " $? " -ne 0 ]; then
82- echo " Can't create tmp dir $tmpdir " | $mail -s " $subj " $email
82+ echo " Can't create tmp dir $tmpdir " | $send_mail -s " $subj " $email
8383 echo " Error: can't create tmp dir"
8484 log_event " $E_NOTEXIST " " $EVENT "
85+ exit $E_NOTEXIST
8586fi
8687
8788# Backingup system configs
316317 cd $HOMEDIR /$user /mail/$domain
317318 accounts=$( ls)
318319 if [ ! -z " $accounts " ]; then
319- tar -cf $tmpdir /mail/$domain /accounts.tar $accounts
320+ tar -cpf $tmpdir /mail/$domain /accounts.tar $accounts
320321 fi
321322
322323 if [ ! -z " $BACKUP_GZIP " ] && [ ! -z $accounts ]; then
@@ -484,7 +485,8 @@ local_backup(){
484485
485486 if [ " $disk_usage " -ge " $BACKUP_DISK_LIMIT " ]; then
486487 rm -rf $tmpdir
487- echo " Not enough disk space to run backup" | $mail -s " $subj " $email
488+ echo " Not enough disk space to run backup" | \
489+ $send_mail -s " $subj " $email
488490 echo " Error: Not enough disk space"
489491 sed -i " / $user /d" $VESTA /data/queue/backup.pipe
490492 log_event " $E_DISK " " $EVENT "
@@ -522,7 +524,7 @@ ftp_backup() {
522524 # Checking config
523525 if [ ! -e " $VESTA /conf/ftp.backup.conf" ]; then
524526 ftp_conf_error=" Can't open $VESTA /conf/ftp.backup.conf"
525- echo " $ftp_conf_error " | $mail -s " $subj " $email
527+ echo " $ftp_conf_error " | $send_mail -s " $subj " $email
526528 echo " Error: $VESTA /conf/ftp.backup.conf does not exist"
527529 sed -i " / $user /d" $VESTA /data/queue/backup.pipe
528530 log_event " $E_NOTEXIST " " $EVENT "
@@ -535,7 +537,8 @@ ftp_backup() {
535537 # Checking variables
536538 if [ -z " $HOST " ] || [ -z " $USERNAME " ] || [ -z " $PASSWORD " ]; then
537539 rm -rf $tmpdir
538- echo " Can't parse ftp backup configuration" | $mail -s " $subj " $email
540+ echo " Can't parse ftp backup configuration" | \
541+ $send_mail -s " $subj " $email
539542 echo " Error: Parsing error"
540543 sed -i " / $user /d" $VESTA /data/queue/backup.pipe
541544 log_event " $E_PARSING " " $EVENT "
@@ -549,7 +552,8 @@ ftp_backup() {
549552 # Checking ftp connection
550553 if [ ! -z " $( ftpc) " ]; then
551554 rm -rf $tmpdir
552- echo " Can't login to ftp://$USERNAME @$HOST " | $mail -s " $subj " $email
555+ echo " Can't login to ftp://$USERNAME @$HOST " | \
556+ $send_mail -s " $subj " $email
553557 echo " Error: can't login to ftp"
554558 sed -i " / $user /d" $VESTA /data/queue/backup.pipe
555559 log_event " $E_FTP " " $EVENT "
@@ -562,7 +566,8 @@ ftp_backup() {
562566 ftp_result=$( ftpc " mkdir $ftmpdir " " rm $ftmpdir " )
563567 if [ ! -z " $ftp_result " ] ; then
564568 rm -rf $tmpdir
565- echo " Can't create ftp backup folder" | $mail -s " $subj " $email
569+ echo " Can't create ftp backup folder" | \
570+ $send_mail -s " $subj " $email
566571 echo " Error: cant's create ftp folder"
567572 sed -i " / $user /d" $VESTA /data/queue/backup.pipe
568573 log_event " $E_FTP " " $EVENT "
@@ -660,7 +665,7 @@ sed -i "/ $user /d" $VESTA/data/queue/backup.pipe
660665if [ " $notify " != ' no' ]; then
661666 subj=" $user → backup has been completed"
662667 email=$( get_user_value ' $CONTACT' )
663- echo -e " $msg " | $mail -s " $subj " $email
668+ echo -e " $msg " | $send_mail -s " $subj " $email
664669fi
665670
666671# Logging
0 commit comments