Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/usr/bin/perl -w
$d_name="/export/mksysb/";
$min_age=12;
$max_gen=2;
$secs_in_day = 60 * 60 * 24;
$now = int ((time)/($secs_in_day));
(undef,undef,undef,$day,$month,$year,undef,undef,undef)=localtime(time);
$dstring = sprintf "%2.2d%2.2d%2.2d", $year % 100, $month + 1, $day;
$extn = "_[0-9][0-9][0-9][0-9][0-9][0-9]";
sub backup;
sub housekeep;
HOSTLOOP: for my $hostname (`lsnim -t standalone | cut -f 1 -d ' '`)
{
$hostname =~ /^b02201$/ and next;
print "Checking $hostname";
chomp $hostname;
for ( glob "$d_name$hostname$extn" )
{
next HOSTLOOP if ($now - int(((stat($_))[9])/($secs_in_day)) < $min_age );
}
backup $hostname;
my @flist = glob "$d_name$hostname$extn";
housekeep $hostname if @flist > $max_gen;
}
sub backup
{
my $hostname = shift;
system "nim -F -o define -t mksysb -a server=master -a mk_image=yes "
."-a mksysb_flags=ei -a source=${hostname} "
."-a location=$d_name${hostname}_$dstring ${hostname}_$dstring";
system "rcp ${hostname}:/bosinst.data ${d_name}${hostname}_bosinst_data_$dstring" and return;
system "nim -o define -t bosinst_data -a server=master ".
"-a location=${d_name}${hostname}_bosinst_data_$dstring ".
"${hostname}_bosinst_data_$dstring";
}
sub housekeep
{
my $hostname = shift;
(glob "$d_name$hostname$extn")[0] =~ /(\d{6})/ and my $date = $1;
for ( "_", "_bosinst_data_" )
{
system "nim -o remove $hostname$_$date";
system "rm $d_name$hostname$_$date";
}
}