From 83a5d28b8d670d90cc1dff33568cc7dfe2812258 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 18 Feb 2010 13:45:40 +0100 Subject: [PATCH] push bak update with --install --- server.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server.pl b/server.pl index 13da6cf..c7b842a 100755 --- a/server.pl +++ b/server.pl @@ -24,6 +24,12 @@ use strict; use autodie; use IO::Socket::INET; use File::Path; +use Getopt::Long; + +my $install = 0; +GetOptions( + 'install!' => \$install, +) || die "$!\n"; my ( $dir, $server_ip ) = @ARGV; die "usage: $0 /backup/directory\n" unless $dir; @@ -37,6 +43,17 @@ __SHELL_CLIENT__ chdir $dir; system 'git init' unless -e '.git'; +if ( $install ) { + open(my $fh, '>', '/tmp/bak'); + print $fh $shell_client; + close($fh); + + foreach my $hostname ( glob '*' ) { + warn "install on $hostname\n"; + system "scp /tmp/bak root\@$hostname:/usr/local/bin/"; + } +} + my $server = IO::Socket::INET->new( Proto => 'tcp', LocalAddr => $server_ip, -- 2.20.1