projects
/
bak-git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
push bak update with --install
[bak-git.git]
/
server.pl
diff --git
a/server.pl
b/server.pl
index
13da6cf
..
c7b842a
100755
(executable)
--- a/
server.pl
+++ b/
server.pl
@@
-24,6
+24,12
@@
use strict;
use autodie;
use IO::Socket::INET;
use File::Path;
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;
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';
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,
my $server = IO::Socket::INET->new(
Proto => 'tcp',
LocalAddr => $server_ip,