moved to git default tip
authorMatthias Förste <foerste@schlittermann.de>
Thu, 11 Oct 2018 09:48:57 +0200
changeset 2 a34a6389b5ee
parent 1 12340919f4e9
moved to git
00MOVED
get-all
get-config
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/00MOVED	Thu Oct 11 09:48:57 2018 +0200
@@ -0,0 +1,1 @@
+This repo moved to our git repository.
--- a/get-all	Thu Oct 11 09:39:21 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#! /usr/bin/perl
-# Grit Schlorke
-# zieht alle configs nacheinander
-#
-
-use warnings;
-use strict;
-use Net::Ping;
-
-my $dirname = "/root/Configs/Hosts";
-my $ping = Net::Ping->new("icmp");
-
-opendir (DIR, $dirname) or die "Can't open directory: \"$dirname\": $!\n";
-
-
-while (defined (my $file = readdir(DIR))) {
-
-    next if $file ~~ [ qw(
-    asterisk.is.schlittermann.de
-    debian.net.besico.de
-    debian-alt.net.besico.de
-    fileserver2-a.net.cms.de
-    fileserver2-a.net.cms.de
-    heinz.dd.dtele.de
-    sonne.dd.dtele.de
-    mail.ccos.de
-    gtd15.g-t-d.de) ];
-
-    (system ("./get-config", $file) == 0 or warn "Can't get-config (returned: $? // $!)\n") if $file ~~ [ qw(
-    emil.frey.kx.schlittermann.de
-    ahwinter.dyn.schlittermann.de
-    portal.mm.frey.kx.schlittermann.de
-    proxy.mm.frey.kx.schlittermann.de
-    webian2.sachsengarage.de) ] or $ping->ping($file, 3);
-
-}
-
-# vim:sts=4 sw=4 ai aw sm:
--- a/get-config	Thu Oct 11 09:39:21 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-#! /usr/bin/perl -w
-# (c) Heiko Schlittermann <hs@schlittermann.de>
-my $USAGE = <<'XXX';
-Usage: $ME [options] host ...
-       -b --[no]backup make backup [$opt_backup]
-       -m --[no]mkdir  make needed archive directory [$opt_mkdir]
-       -v --[no]verbose be verbose [$opt_verbose]
-       -k --keepgoing  don't stop on errors [$opt_keepgoing]
-       -d --[no]debug show rsync command line
-XXX
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-use Socket;
-use IO::File;
-
-my $ME = basename $0;
-my $ARCHIVE = "./Hosts";
-my $CONFIGS = "./configs";
-
-my $opt_backup = 0;
-my $opt_mkdir = 0;
-my $opt_verbose = 0;
-my $opt_keepgoing = 0;
-my $opt_debug = 0;
-
-sub readConfig($);
-
-MAIN: {
-
-my $x = select STDOUT;
-$|++;
-select STDERR;
-$|++;
-select $x;
-
-    GetOptions(
-	"mkdir!" => \$opt_mkdir,
-	"verbose!" => \$opt_verbose,
-	"keepgoing" => \$opt_keepgoing,
-	"backup!" => \$opt_backup,
-	"debug!" => \$opt_debug,
-    ) or die eval "\"$USAGE\"";
-
-    @ARGV or die eval "\"$USAGE\"";
-    foreach (@ARGV) {
-	local $_ = $_;
-	(my $host = $_) =~ s/.*\/([a-z0-9.-]+).*/$1/;
-	my $ip = scalar gethostbyname($host);
-	$ip or do {
-	    warn "can't resolve $host\n";
-	    next;
-	};
-	my $addr = inet_ntoa($ip);
-	my $dst = "$ARCHIVE/$host";
-	my $done = "$ARCHIVE/.done.$host";
-	my $conf = "$CONFIGS/$host";
-	    -f $conf or $conf = "$CONFIGS/default";
-
-	-d $dst or $opt_mkdir and ( mkdir $dst, 0700 
-	    or die "$ME: Can't mkdir $dst: $!\n" );
-
-	-d $dst or die "$ME: $dst: $!\n";
-
-
-	print "OK, Host: $host [$addr] - $conf\n";
-
-	my @config = readConfig($conf);
-
-	my @cmd = (qw(rsync --rsh), "ssh -x", 
-		qw(--compress --numeric-ids
-		   --delete --delete-excluded 
-		   --archive --relative));
-	push @cmd, "--backup" if $opt_backup;
-	push @cmd, "--verbose" if $opt_verbose;
-
-	if (my @excludes = map { /^!\s*(.*)/ ? ("--exclude" => $1) : () } @config) {
-	    push @cmd, @excludes;
-	}
-
-	foreach (@config) {
-
-	    /^[\/\?]/ or next;	# Nun muß es mit / oder ? losgehen
-
-	    my $gflag = s/^(.)\s*(?=\/)// ? $1 : "";
-
-	    my @files = /\|\|/ ? split /\s*\|\|\s*/, $_ : $_;
-	    my @status;
-
-
-	    FILES: foreach (@files) {
-
-		my $flag = @files > 1 ? "?" : $gflag;
-
-		my $status = "";
-
-		my $src = "root\@$host:$_";
-		print "* [" . ($flag ? $flag : " ") . "] $src -> $dst ";
-
-		open(TMP, "+>/tmp/xx.$$") or die "$ME: Can't open /tmp/xx.$$";
-		unlink "/tmp/xx.$$";
-		my $pid = fork();
-
-		die "Can't fork" if not defined $pid;
-		warn "== DEBUG: @cmd $src $dst\n" if $opt_debug;
-		if ($pid == 0) {	# child
-		    open(STDERR, ">&TMP") or die "$!";
-		    open(STDOUT, ">/dev/null") unless $opt_verbose;
-		    exec @cmd, $src, $dst;
-		} else {
-		    waitpid $pid, 0;
-		}
-		if ($?) { 
-		    $status = "ERR " . ($? >> 8);
-		    $status .= " SIGNAL " . ($? & 127);
-		    seek(TMP, 0, 0);
-		    $_ = <TMP>;
-
-		    if ($flag eq "?" and /(?<=failed:)(.*\(2\).*)/) {
-			$status = "OK (but: $1)";
-		    } else {
-			$status .= "\n\t$_";
-		    }
-		} else { $status = "OK"; };
-
-		push @status, "$src: $status";
-
-		open(DATE, ">>$done") or die "$ME: Can't open >>$done: $!\n";
-		print(DATE scalar(localtime), " [$status]\n");
-		close (DATE);
-
-		if ($status !~ /^OK/) {
-		    die "\t$ME: system command ended with $status" unless $opt_keepgoing;
-		} else {
-		    print "[$status]\n";
-		}
-
-		last FILES if $status eq "OK";
-
-	    }
-
-	    if ($gflag ne "?" and @files > 1 and ! grep /: OK$/, @status) {
-		die "** Alternative failed:\n",
-		    join("\n", map {"\t$_" } @status), "\n";
-	    }
-	}
-
-	system "ssh", "root\@$host", "touch /var/lib/get-config.stamp";
-
-    }
-
-    print "\n";
-}
-
-sub readConfig($) {
-    my @conf;
-
-    my $file = shift;
-    my $cf = new IO::File $file or die "Can't open $file: $!\n";
-
-    while (<$cf>) {
-	s/^\s*//;
-	next if /^(#|\s*$)/;
-	chomp;
-
-
-	while (s/\s*\\$// and !eof) {
-	    chomp($_ .= " " . <$cf>);
-	}
-
-	if (/^<(.*)/) {
-	    push @conf, readConfig(dirname($file) . "/$1");
-	    next;
-	}
-
-	push @conf, $_;
-    }
-
-    return @conf;
-}
-
-# vim:sts=4 sw=4 aw ai sm: