-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmytest.pl
More file actions
59 lines (53 loc) · 2.63 KB
/
mytest.pl
File metadata and controls
59 lines (53 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl -w
#########################################################################################################################
# #
# the script uses "recycle.cfg" file that configures pool followed by retention time in days #
# the calculation is made on the number of days required in each pool compared to the current ssid definition #
# the only reason not to use Networkers own retention is avoiding usage of too many client per backup group #
# #
#########################################################################################################################
use Date::Calc qw(Delta_Days Add_Delta_Days);
#($today, $thisMonth, $thisYear) = (localtime)[3, 4, 5];
%pools = &getPools("myrecycle.cfg");
foreach $pool (keys(%pools)) {
$offset = $pools{$pool};
chomp $pool;
print "pool is: $pool\n";
# @ssid = &getSsid($pool);
# foreach (@ssid) {
# chomp;
# ($y1, $m1, $d1) = getDate($_, 'savetime');
# ($y2, $m2, $d2) = getDate($_, 'ssretent');
# chomp($y1, $m1, $d1, $y2, $m2, $d2);
# $delta = Delta_Days($y1, $m1, $d1, $y2, $m2, $d2);
# ($year, $month, $day) = Add_Delta_Days($y1, $m1, $d1, $offset);
# if ($delta > $offset) {
# print "ssid: $_, ssretent:$m2-$d2-$y2, savetime: $m1-$d1-$y1, delta: $delta, shouldbe: $month-$day-$year\n";
### The only thing the script does is the following line: change retention and browse policy of the alleged ssid ###
# system("/usr/sbin/nsrmm -S $ssid -w $month/$day/$year -e $month/$day/$year");
# system("/usr/sbin/mminfo -q \"ssid=$ssid\" -r \"savetime,ssretent,ssbrowse,state,pool\"");
# }
# }
}
sub getDate {
$ssid = $_[0];
$infoType = $_[1];
$date = `/usr/sbin/mminfo -q \"ssid=$ssid\" -r $infoType | /bin/grep -v $infoType`;
return &splitDays($date);
}
sub splitDays {
$infoType = shift;
($m, $d, $y)=split(/\//, $infoType);
return($y, $m, $d);
}
sub getSsid {
$pool = shift;
return `/usr/sbin/mminfo -q \"pool=$pool\" -r ssid | /bin/grep -v ssid`;
}
sub getPools {
$POOLS=shift;
open(POOLS);
%pools=<POOLS>;
close(POOLS);
return %pools;
}