summaryrefslogtreecommitdiffstats
path: root/.local/bin/sync-push.pl
blob: 91b9e83a18d344d288569ae517117350e61cfc9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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__