diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-03-19 14:50:04 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-03-20 15:01:21 -0700 |
commit | 0f132e0a7cc2a90a325a5615abd15f7b1c49a820 (patch) | |
tree | 97a16c98a838f75a9edc8acf34330c03bfc6368b /bin | |
parent | ed47e018612ca46dd18c27c80958675ecce33cbb (diff) | |
download | dotfiles-0f132e0a7cc2a90a325a5615abd15f7b1c49a820.tar.gz |
expand-annex-mboxes: tidy up flocking
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/expand-annex-mboxes | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/bin/expand-annex-mboxes b/bin/expand-annex-mboxes index ecce1002..7f3525bc 100755 --- a/bin/expand-annex-mboxes +++ b/bin/expand-annex-mboxes @@ -17,10 +17,9 @@ our $expanded = "$ENV{HOME}/.fmail/annex"; # CODE -# flock ourselves to ensure that only one copy of this script is ever -# running -exit 0 unless flock DATA, LOCK_EX|LOCK_NB; -die "no movemymail\n" if -e "$ENV{HOME}/.nomovemymail"; +# flock ourselves to ensure that only one copy of this script is ever running +open our $us, "<", $0 or die $!; +exit 0 unless flock $us, LOCK_EX|LOCK_NB; make_path($expanded); open my $touch_fh, '>', "$expanded/.duplicity-ignore"; @@ -34,6 +33,3 @@ foreach my $mbox (glob "$mboxes/*.gz") { $name =~ s/\.gz$//; expand_mbox($mbox, catfile($expanded, $name)); } - -# needed for above flock to work (__DATA__ would also work) -__END__ |