1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-samba-1.14.1/root/etc/e-smith/events/actions/shadow-copy-rotate mezzanine_patched_e-smith-samba-1.14.1/root/etc/e-smith/events/actions/shadow-copy-rotate |
2 |
--- e-smith-samba-1.14.1/root/etc/e-smith/events/actions/shadow-copy-rotate 2007-12-15 08:53:08.000000000 -0700 |
3 |
+++ mezzanine_patched_e-smith-samba-1.14.1/root/etc/e-smith/events/actions/shadow-copy-rotate 2008-03-13 13:31:18.000000000 -0600 |
4 |
@@ -28,12 +28,20 @@ |
5 |
my $snapfmt = '@GMT-%Y.%m.%d-%H.%M.%S'; |
6 |
|
7 |
# Create list of ibays and users to shadow |
8 |
-my $ibays = join ',', map { $_->key } grep { ($_->prop('ShadowCopy') || 'enabled') ne 'disabled' } $adb->ibays(); |
9 |
-my $users = join ',', map { $_->key } grep { ($_->prop('ShadowCopy') || 'enabled') ne 'disabled' } $adb->users(); |
10 |
+my ($ibays, $users, $link) = ('','',''); |
11 |
+my @ibays = grep { ($_->prop('ShadowCopy') || 'enabled') ne 'disabled' } $adb->ibays(); |
12 |
+$ibays = "$filesdir/./ibays/{" . join(',', map { $_->key } @ibays) . "}/" if scalar @ibays > 1; |
13 |
+$ibays = "$filesdir/./ibays/" . $ibays[0]->key . "/" if scalar @ibays == 1; |
14 |
+my @users = grep { ($_->prop('ShadowCopy') || 'enabled') ne 'disabled' } $adb->users(); |
15 |
+$users = "$filesdir/./users/{" . join(',', map { $_->key } @users) . "}/home/" if scalar @users > 1; |
16 |
+$users = "$filesdir/./users/" . $users[0]->key . "/home/" if scalar @users == 1; |
17 |
+$link = "--link-dest ../1" if -d "$shadowdir/1"; |
18 |
|
19 |
# Sync directories to shadow directory |
20 |
-system("rsync -aHmR --partial --exclude '\@GMT-*' --link-dest ../1 " . |
21 |
- "$filesdir/./ibays/{$ibays}/ $filesdir/./users/{$users}/home/ $shadowdir/0/") == 0 || die "Couldn't sync directories"; |
22 |
+if ( $ibays || $users) { |
23 |
+ system("rsync -aHmR --partial --exclude '\@GMT-*' $link $ibays $users $shadowdir/0/") == 0 |
24 |
+ or die "Couldn't sync directories"; |
25 |
+} |
26 |
|
27 |
# Shift directories using geometric roll-off (only if different) |
28 |
if ( -d "$shadowdir/1" ) { |