I wrote a quick perl script to test the read and write speeds of a file system in Linux. Below is the contents of the script.

jtdub@db1 ~]$ cat iobenchmark.pl 
#!/usr/bin/perl

use strict;
use warnings;

my $ioFilePath = "/home/jtdub/iofile";
my $testNumber = "1";
my $ioStatsFile = "/home/jtdub/iostats.txt";
my $testLength = "10";

if(-e $ioStatsFile) {
	`rm -f $ioStatsFile`;
}

while ($testNumber <= $testLength) {
	if(-e $ioFilePath) {
		print "Removing $ioFilePath before starting the test. Test: $testNumber.\n";
		`rm -f $ioFilePath`;
	}
	open(STATS, ">> $ioStatsFile");
		print STATS "-----------------------------------------\n";
		print STATS "\nTesting write speeds. Test: $testNumber.\n\n";
		print STATS `dd if=/dev/zero of=$ioFilePath bs=1M count=500 2>> $ioStatsFile`;
		print STATS "\nTesting read speeds. Test $testNumber.\n\n";
		print STATS `dd if=$ioFilePath of=/dev/zero 2>> $ioStatsFile`;
		print STATS "-----------------------------------------\n\n";
	$testNumber++;		
}
close(STATS);

 

Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone

I forgot about this. This was a perl script that I used to use to connect to Hurricane Electric IPv6 Network via PPTP. Last I checked, their pptp servers were offline. Bummer for those who can’t do IPv6 in IP tunneling. Requires the pptp-setup package.

#!/usr/bin/perl

$pptpServer = "HE_PPTPSERVER";
$pptpUsername = "USERNAME";
$pptpPassword = "PASSWORD";

$tunRemote = "TUN_DESTIPADDR";
$tunClient = "TUN_CLIENTIPADDR";

$client6 = "TUN_IPV6ADDR";

if(!$ARGV[0]) {
print "$0 [start | stop]\n";
} elsif($ARGV[0] eq "start") {
`pptpsetup --create ipv6 --server $pptpServer --username $pptpUsername --password $pptpPassword --start`;
`ip tunnel add sixbone mode sit remote $tunRemote local $tunClient ttl 255 dev ppp0`;
`ip link set sixbone up`;
`ip addr add $client6 dev sixbone`;
`ip route add ::/0 dev sixbone`;
`ip route add 2000::/3 dev sixbone`;
} elsif($ARGV[0] eq "stop") {
`ip route del ::/0 dev sixbone`;
`ip route del 2000::/3 dev sixbone`;
`ip addr del $client6 dev sixbone`;
`ip link set sixbone down`;
`ip tunnel del sixbone`;
`pptpsetup --delete ipv6`;
@ps = `ps ax | grep pptp`;
foreach $proc (@ps) {
@pid = split(/ +/,$proc);
`kill -9 $pid[1]`;
};
} else {
print "$0 [start | stop]\n";
}
Share on FacebookTweet about this on TwitterShare on LinkedInShare on RedditEmail this to someone