diff -ruN e-smith-backup-2.2.0.old/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.2.0/root/etc/e-smith/events/actions/workstation-backup-dar --- e-smith-backup-2.2.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2013-05-09 04:02:49.000000000 +0100 +++ e-smith-backup-2.2.0/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-02 12:59:24.000000000 +0100 @@ -40,6 +40,7 @@ my $confdb = esmith::ConfigDB->open; my $backupwk = $confdb->get('backupwk') or die "No backupwk db entry found\n"; +my $internalinterface = $confdb->get('InternalInterface') or die "No internalinterface db entry found\n"; my $tm = localtime(time); my $bkname = $tm->year+1900; @@ -66,6 +67,8 @@ my $smbhost = $backupwk->prop('SmbHost'); my $smbshare = $backupwk->prop('SmbShare'); +my $smbhostmac = $backupwk->prop('SmbHostMAC'); +my $smbhostdelay = $backupwk->prop('SmbHostDelay') || 300; my $login = $backupwk->prop('Login'); my $password = $backupwk->prop('Password'); my $setsmax = $backupwk->prop('SetsMax') || 1; @@ -80,6 +83,7 @@ my $mntdir = $backupwk->prop('Mount') || '/mnt/smb'; my $frommail = $backupwk->prop('FromMail') || 'admin-backup'; my $tomail = $backupwk->prop('ToMail') || 'admin'; +my $ether = $internalinterface->prop('Name'); my $tmpdir; $report .= "From: ".$frommail."\n"; @@ -95,6 +99,15 @@ $report .= "Mounting backup shared directory $smbhost/$smbshare \n"; +# ping the SMB Host to see if it is awake + +if (defined($smbhostmac) && (system("ping -c1 $smbhost > /dev/null") != 0)) { + $report .= "$smbhost might be asleep, attempting to wake\n"; + system("ether-wake -i $ether $smbhostmac"); + $report .= "Waiting $smbhostdelay seconds...\n"; + sleep $smbhostdelay; +} + # verify backup directory not already mounted open FD, '/proc/mounts';