10 my $conf = new Config::General("config");
11 my %config = $conf->getall;
13 print "Logging to $config{remote_host}...\n";
14 my $ssh = Net::SSH::Perl->new($config{remote_host}, debug=>0);
15 $ssh->login($config{remote_user}, $config{remote_pass});
17 print "Dumping DB...\n";
18 my ($stdout, $stderr, $exit) = $ssh->cmd("mysqldump -u$config{remote_db_user} -p$config{remote_db_pass} $config{remote_db_name} > $config{remote_db_name}.sql");
21 print "Compressing DB...\n";
22 ($stdout, $stderr, $exit) = $ssh->cmd("tar czvf $config{remote_db_name}.tar.gz $config{remote_db_name}.sql");
27 print "Downloading DB...\n";
28 my $scp = Net::SCP->new($config{remote_host}, $config{remote_user});
29 $scp->get("$config{remote_db_name}.tar.gz");
31 print "Unpacking DB...\n";
32 `tar -xzvf $config{remote_db_name}.tar.gz`;
34 print "Loading DB...\n";
35 `mysql -u$config{local_db_user} -p$config{local_db_pass} $config{local_db_name} < $config{remote_db_name}.sql`;
39 Growl::NotifySend->show(
40 summary => "DB Import",