]> ruin.nu Git - ndwebbie.git/commitdiff
script that resets the host for users
authorMichael Andreen <harv@ruin.nu>
Sun, 16 Sep 2007 11:26:06 +0000 (13:26 +0200)
committerMichael Andreen <harv@ruin.nu>
Sun, 16 Sep 2007 11:26:06 +0000 (13:26 +0200)
scripts/reset_hosts.pl [new file with mode: 0755]

diff --git a/scripts/reset_hosts.pl b/scripts/reset_hosts.pl
new file mode 100755 (executable)
index 0000000..4932f05
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use DBI;
+use DBD::Pg qw(:pg_types);
+
+use LWP::Simple;
+
+our $dbh;
+for my $file ("/home/whale/db.pl")
+{
+       unless (my $return = do $file){
+               warn "couldn't parse $file: $@" if $@;
+               warn "couldn't do $file: $!"    unless defined $return;
+               warn "couldn't run $file"       unless $return;
+       }
+}
+
+$dbh->trace("0","/tmp/scanstest");
+my $update = $dbh->prepare("UPDATE users SET hostmask = pnick || '.users.netgamers.org' where hostmask ilike '%.%' AND NOT hostmask ilike pnick || '.users.netgamers.org'");
+$update->execute();
+$dbh->disconnect;