Difference between revisions of "Unison.pl"
(How can I allow a Unison profile to be initiated from either end?) |
m |
||
Line 17: | Line 17: | ||
</perl> | </perl> | ||
− | == How can I allow a Unison profile to be initiated from either end? == | + | == Notes == |
+ | |||
+ | === How can I allow a Unison profile to be initiated from either end? === | ||
Imagine syncing between a laptop and a desktop computer, using the "minimal profile" from the manual. But you want to be able to initiate the synchronization from both computers. On the desktop use the profile: | Imagine syncing between a laptop and a desktop computer, using the "minimal profile" from the manual. But you want to be able to initiate the synchronization from both computers. On the desktop use the profile: | ||
{{code|<pre> | {{code|<pre> |
Revision as of 06:30, 19 July 2009
<perl>
- !/usr/bin/perl
use Expect; require( '/var/www/tools/wikid.conf' ); $bak_user = $name unless defined $bak_user;
for $dir ( @bak_paths ) { $cmd = "unison $dir ssh://$bak_user\@$bak_server$dir -batch -force $dir"; $exp = Expect->spawn( $cmd ); $exp->expect( undef, [ qr/password:/ => sub { my $exp = shift; $exp->send( "$bak_pass\n" ); exp_continue; } ], [ qr/Synchronization complete/ => sub { } ], ); $exp->soft_close(); } </perl>
Notes
How can I allow a Unison profile to be initiated from either end?
Imagine syncing between a laptop and a desktop computer, using the "minimal profile" from the manual. But you want to be able to initiate the synchronization from both computers. On the desktop use the profile:
While on the laptop you use:
On both ends, you maintain the included file .unison/homedir.prf, with the paths (and other settings):
Note that the homedir.prf file itself is specified as a path to be synchronized.