diff -Nur e-smith-backup-2.4.0.bz9090.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup e-smith-backup-2.4.0.bz9090.new/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup --- e-smith-backup-2.4.0.bz9090.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2015-10-11 21:55:16.705468622 +0200 +++ e-smith-backup-2.4.0.bz9090.new/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2015-10-29 22:56:34.807907323 +0100 @@ -928,5 +928,8 @@ Mounted disk Mounted disk - - + + ERROR_WHEN_TESTING_REMOTE_SERVER + The parameters have been saved, however the remote host is not reachable, please check your settings. + + diff -Nur e-smith-backup-2.4.0.bz9090.old/root/etc/e-smith/web/functions/backup e-smith-backup-2.4.0.bz9090.new/root/etc/e-smith/web/functions/backup --- e-smith-backup-2.4.0.bz9090.old/root/etc/e-smith/web/functions/backup 2015-10-11 21:55:16.741473836 +0200 +++ e-smith-backup-2.4.0.bz9090.new/root/etc/e-smith/web/functions/backup 2015-10-15 23:47:28.040059646 +0200 @@ -1729,6 +1729,21 @@ system("/sbin/e-smith/signal-event", "conf-backup") == 0 or die($fm->localise('ERR_CONF_BACKUP'),"\n"); + # we test if the remote host is reachable, else we simply display a warning + if ( $VFSType =~ m/cifs|nfs/s ) + { + my $error_message = vmount($backupwkStation,$backupwkFolder,$backupwkMount,$VFSType); + if (! $error_message) + { + bunmount($backupwkMount,$VFSType); + } + elsif ($error_message) + { + esmith::cgi::genResult($q, $fm->localise('ERROR_WHEN_TESTING_REMOTE_SERVER').$q->br() . "$error_message"); + return; + } + } + esmith::cgi::genResult( $q, $fm->localise('SUCCESSFULLY_ENABLED_WORKSTN').$q->br(). $fm->localise('WITH_BACKUP_TIME')."$backupwkHour:$backupwkMin"); @@ -3217,6 +3232,23 @@ return; } +#Used to test if the remote share is mountable when you save settings in database +sub vmount +{ + # mount dar unit according to dar-workstation configuration in order to test the remote host + # return nothing if mount successfull + my ($host,$share,$mountdir,$VFSType) = @_; + if ($VFSType eq 'cifs') + { + return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix 2>&1) ); + } + elsif ($VFSType eq 'nfs') + { + return ( qx(/bin/mount -t nfs -o nolock,timeo=30,retrans=1,retry=0 "$host:/$share" $mountdir 2>&1) ); + } + +} + __DATA__