1 |
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 |
2 |
--- e-smith-backup-2.2.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2013-05-09 04:02:49.000000000 +0100 |
3 |
+++ e-smith-backup-2.2.0/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-02 12:59:24.000000000 +0100 |
4 |
@@ -40,6 +40,7 @@ |
5 |
|
6 |
my $confdb = esmith::ConfigDB->open; |
7 |
my $backupwk = $confdb->get('backupwk') or die "No backupwk db entry found\n"; |
8 |
+my $internalinterface = $confdb->get('InternalInterface') or die "No internalinterface db entry found\n"; |
9 |
|
10 |
my $tm = localtime(time); |
11 |
my $bkname = $tm->year+1900; |
12 |
@@ -66,6 +67,8 @@ |
13 |
|
14 |
my $smbhost = $backupwk->prop('SmbHost'); |
15 |
my $smbshare = $backupwk->prop('SmbShare'); |
16 |
+my $smbhostmac = $backupwk->prop('SmbHostMAC'); |
17 |
+my $smbhostdelay = $backupwk->prop('SmbHostDelay') || 300; |
18 |
my $login = $backupwk->prop('Login'); |
19 |
my $password = $backupwk->prop('Password'); |
20 |
my $setsmax = $backupwk->prop('SetsMax') || 1; |
21 |
@@ -80,6 +83,7 @@ |
22 |
my $mntdir = $backupwk->prop('Mount') || '/mnt/smb'; |
23 |
my $frommail = $backupwk->prop('FromMail') || 'admin-backup'; |
24 |
my $tomail = $backupwk->prop('ToMail') || 'admin'; |
25 |
+my $ether = $internalinterface->prop('Name'); |
26 |
my $tmpdir; |
27 |
|
28 |
$report .= "From: ".$frommail."\n"; |
29 |
@@ -95,6 +99,15 @@ |
30 |
|
31 |
$report .= "Mounting backup shared directory $smbhost/$smbshare \n"; |
32 |
|
33 |
+# ping the SMB Host to see if it is awake |
34 |
+ |
35 |
+if (defined($smbhostmac) && (system("ping -c1 $smbhost > /dev/null") != 0)) { |
36 |
+ $report .= "$smbhost might be asleep, attempting to wake\n"; |
37 |
+ system("ether-wake -i $ether $smbhostmac"); |
38 |
+ $report .= "Waiting $smbhostdelay seconds...\n"; |
39 |
+ sleep $smbhostdelay; |
40 |
+} |
41 |
+ |
42 |
# verify backup directory not already mounted |
43 |
|
44 |
open FD, '/proc/mounts'; |