summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-10-20 22:52:57 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-10-20 22:52:57 +0200
commit6eb0ac1e7aea7273db654141ae0ded8b82cf6978 (patch)
tree02df2a32b61b3ac403d6497d3873e10490cfdc71
parentAlias fix (diff)
downloaddotfiles-bsd-6eb0ac1e7aea7273db654141ae0ded8b82cf6978.tar.gz
dotfiles-bsd-6eb0ac1e7aea7273db654141ae0ded8b82cf6978.tar.bz2
dotfiles-bsd-6eb0ac1e7aea7273db654141ae0ded8b82cf6978.tar.xz
dotfiles-bsd-6eb0ac1e7aea7273db654141ae0ded8b82cf6978.tar.zst
dotfiles-bsd-6eb0ac1e7aea7273db654141ae0ded8b82cf6978.zip
Added newsboat/abook cron sync scripts
-rwxr-xr-x.local/bin/sync-pull.pl38
-rwxr-xr-x.local/bin/sync-push.pl42
2 files changed, 80 insertions, 0 deletions
diff --git a/.local/bin/sync-pull.pl b/.local/bin/sync-pull.pl
new file mode 100755
index 0000000..c5ddb94
--- /dev/null
+++ b/.local/bin/sync-pull.pl
@@ -0,0 +1,38 @@
+#!/usr/local/bin/perl
+
+use strict;
+use warnings;
+
+sub main
+{
+ my $i;
+
+ print "Check...\n";
+ $i = 0;
+ while (system('/bin/pgrep', 'newsboat') == 0) {
+ print "newsboat running, exiting...";
+ exit 1;
+ }
+ system(
+ '/usr/local/bin/rsync',
+ '-a',
+ '-e',
+ 'ssh',
+ 'root@207.246.81.115:/root/sync/newsboat/cache.db',
+ '/home/jozan/.local/share/newsboat/cache.db'
+ );
+ system(
+ '/usr/local/bin/rsync',
+ '-a',
+ '-e',
+ 'ssh',
+ 'root@207.246.81.115:/root/sync/abook/addressbook',
+ '/home/jozan/.abook/addressbook'
+ );
+ exit 0;
+}
+
+main();
+
+__END__
+
diff --git a/.local/bin/sync-push.pl b/.local/bin/sync-push.pl
new file mode 100755
index 0000000..91b9e83
--- /dev/null
+++ b/.local/bin/sync-push.pl
@@ -0,0 +1,42 @@
+#!/usr/local/bin/perl
+
+use strict;
+use warnings;
+
+sub main
+{
+ my $i;
+
+ print "Check...\n";
+ $i = 0;
+ while (system('/bin/pgrep', 'newsboat') == 0) {
+ sleep 5;
+ $i += 1;
+ print "Waiting...\n";
+ if ($i == 12) {
+ print "Too long, exiting...\n";
+ exit 1;
+ }
+ }
+ system(
+ '/usr/local/bin/rsync',
+ '-a',
+ '-e',
+ 'ssh',
+ '/home/jozan/.local/share/newsboat/cache.db',
+ 'root@207.246.81.115:/root/sync/newsboat/cache.db'
+ );
+ system(
+ '/usr/local/bin/rsync',
+ '-a',
+ '-e',
+ 'ssh',
+ '/home/jozan/.abook/addressbook',
+ 'root@207.246.81.115:/root/sync/abook/addressbook'
+ );
+ exit 0;
+}
+
+main();
+
+__END__