Created
January 2, 2014 02:36
-
-
Save shalk/8214155 to your computer and use it in GitHub Desktop.
dd system for 24 disk only need modified dd_task function on line 31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
our @empty=(b..x); | |
our @full= (a); | |
my $round = 1; | |
OUT:while(1) | |
{ | |
print "#############\n"; | |
foreach my $s (@full){ | |
my $dest = shift @empty; | |
last OUT unless defined( $dest); | |
&dd_task($s,$dest); | |
} | |
print "########scan once#####\n"; | |
@full=(); | |
sleep 1; | |
&check_status; | |
} | |
foreach(a..x){ | |
my $filename = "sd${_}_idle"; | |
if( -e $filename){ | |
system("rm $filename"); | |
} | |
} | |
sub dd_task{ | |
my $source = shift; | |
my $dest = shift; | |
print "dd if=/dev/sd$source of=/dev/sd$dest bs=512 count=10000 \n"; | |
system("touch sd${dest}_idle ;touch sd${source}_idle") ; | |
} | |
sub check_status{ | |
foreach(a..x){ | |
my $filename = "sd${_}_idle"; | |
if( -e $filename){ | |
push @full, $_; | |
system("rm $filename"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment