Instead, use the change and delete hooks, and launch rsync if either hook
is called.
sub import {
hook(type => "getsetup", id => "rsync", call => \&getsetup);
sub import {
hook(type => "getsetup", id => "rsync", call => \&getsetup);
- hook(type => "postrefresh", id => "rsync", call => \&postrefresh);
+ hook(type => "change", id => "rsync", call => \&postrefresh);
+ hook(type => "delete", id => "rsync", call => \&postrefresh);
- if (defined $config{rsync_command}) {
+ if (defined $config{rsync_command} && ! $ran) {
+ $ran=1;
chdir($config{destdir}) || error("chdir: $!");
system $config{rsync_command};
if ($? == -1) {
chdir($config{destdir}) || error("chdir: $!");
system $config{rsync_command};
if ($? == -1) {
if (%rendered) {
run_hooks(change => sub { shift->(keys %rendered) });
}
if (%rendered) {
run_hooks(change => sub { shift->(keys %rendered) });
}
- run_hooks(postrefresh => sub { shift->() });
}
sub commandline_render () {
}
sub commandline_render () {