--- /dev/null
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Config::General;
+use Net::SSH::Perl;
+use Net::SCP;
+use Growl::NotifySend;
+
+my $conf = new Config::General("config");
+my %config = $conf->getall;
+
+print "Logging to $config{remote_host}...\n";
+my $ssh = Net::SSH::Perl->new($config{remote_host}, debug=>0);
+$ssh->login($config{remote_user}, $config{remote_pass});
+
+print "Dumping DB...\n";
+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");
+print $stdout;
+
+print "Compressing DB...\n";
+($stdout, $stderr, $exit) = $ssh->cmd("tar czvf $config{remote_db_name}.tar.gz $config{remote_db_name}.sql");
+print $stdout;
+
+# Download DB
+
+print "Downloading DB...\n";
+my $scp = Net::SCP->new($config{remote_host}, $config{remote_user});
+$scp->get("$config{remote_db_name}.tar.gz");
+
+print "Unpacking DB...\n";
+`tar -xzvf $config{remote_db_name}.tar.gz`;
+
+print "Loading DB...\n";
+`mysql -u$config{local_db_user} -p$config{local_db_pass} $config{local_db_name} < $config{remote_db_name}.sql`;
+print "Finished!\n";
+
+
+Growl::NotifySend->show(
+ summary => "DB Import",
+ body => "Finished",
+);
--- /dev/null
+#!/usr/bin/env perl
+
+# Uploads local database to the remote server using ssh
+
+use strict;
+use warnings;
+use Config::General;
+use Net::SSH::Perl;
+use Net::SCP;
+use Growl::NotifySend;
+
+my $conf = new Config::General("config");
+my %config = $conf->getall;
+
+# backup local db
+print "Dumping Local DB...\n";
+`mysqldump -C -u$config{local_db_user} -p$config{local_db_pass} $config{local_db_name} > $config{remote_db_name}.sql`;
+
+print "Compressing DB...\n";
+`tar -xzvf $config{remote_db_name}.tar.gz`;
+
+# upload db
+print "Uploading DB...\n";
+my $scp = Net::SCP->new($config{remote_host}, $config{remote_user});
+$scp->put("$config{remote_db_name}.tar.gz");
+
+print "Logging to $config{remote_host}...\n";
+my $ssh = Net::SSH::Perl->new($config{remote_host}, debug=>0);
+$ssh->login($config{remote_user}, $config{remote_pass});
+
+print "Unpacking DB...\n";
+my ($stdout, $stderr, $exit) = $ssh->cmd("tar -xzvf $config{remote_db_name}.tar.gz");
+print $stdout;
+
+print "Loading DB...\n";
+($stdout, $stderr, $exit) = $ssh->cmd("mysql -u$config{remote_db_user} -p$config{remote_db_pass} $config{remote_db_name} < $config{remote_db_name}.sql");
+
+print "$stdout\n";
+print "$stderr\n";
+print "Finished!\n";
+
+Growl::NotifySend->show(
+ summary => "DB Upload",
+ body => "Finished",
+);
+#if [ $? -eq 255 ]; then
+# notify-send "Aktualizacja bazy danych nieudana" \
+# "Skrypt aktualizacyjny bazę na serwerze zdalnym\nzakończył swoją pracę z błędem."
+# exit
+#fi
+#
+#notify-send "Powodzenie wgrywania bazy danych" "Skrypt aktualizacyjny bazę na serwerze zdalnym\nzakończył swoją pracę z sukcesem."