Narada

 view release on metacpan or  search on metacpan

bin/narada-lock-exclusive  view on Meta::CPAN

#!/usr/bin/env perl
use 5.010001;
use warnings;
use strict;
use utf8;

our $VERSION = 'v2.3.8';

use FindBin;
use lib "$FindBin::Bin/../lib/perl5";
use Narada;
use Narada::Lock qw( exclusive_lock unlock_new );

Narada::detect();

local @ARGV = @ARGV ? @ARGV : ('env', 'PS1=[LOCKED] \u@\h \w \$ ', 'bash', '--norc');

exclusive_lock();
{ local $ENV{NARADA_SKIP_LOCK} = 1;
  system @ARGV;
}
unlock_new();
exit $? >> 8;   ## no critic (ProhibitMagicNumbers)


__END__

=encoding utf8

=head1 NAME

narada-lock-exclusive - run command under exclusive lock


=head1 VERSION

This document describes narada-lock-exclusive version v2.3.8


=head1 USAGE

    narada-lock-exclusive [/path/to/commands param ...]


=head1 DESCRIPTION

Should be executed in project deploy directory (or Narada 1.x project root
directory).

Wrapper for running other process under exclusive_lock().
Will also set environment variable NARADA_SKIP_LOCK to "1", so all scripts
executed under this wrapper will not try to set their own locks.

When executed without params will run `bash --norc` with '[LOCKED]' prefix
in $PS1.

Exit status of narada-lock-exclusive will be same as exit status of executed
command.


=head1 CONFIGURATION AND ENVIRONMENT

    .lock
    .lock.new
    $NARADA_SKIP_LOCK


=head1 COMPATIBILITY

Narada 1.x project use C<var/.lock> instead of C<.lock>.

Narada 1.x project use C<var/.lock.new> instead of C<.lock.new>.


=head1 SUPPORT



( run in 1.858 second using v1.01-cache-2.11-cpan-364913b4093 )