Skip to content

Commit

Permalink
mxmount: Add option --reexport-only
Browse files Browse the repository at this point in the history
Calling mxmount with --reexport-only will not try to mount filesystems,
but just rewrite /etc/exports and call exportfs -ra.

This is supposed to be done by clusterd, when the export groups in
/etc/hostconfig were changed.
  • Loading branch information
donald committed Nov 22, 2018
1 parent c515e79 commit 24b66dc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions mxmount/mxmount
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use strict;
use warnings;
use Sys::Hostname;
use Getopt::Long;

my $configfile = "/etc/mxmounts";
my $exports = "/etc/exports";
Expand All @@ -16,6 +17,13 @@ my @exports;
my %V;
my %D;

our $USAGE=<<"_EOF_";
usage: $0
$0 --reexport-only
_EOF_

our ($opt_reexport_only);

$fullhostname = hostname();
($hostname) = $fullhostname =~ /^(.*?)\./;

Expand All @@ -40,9 +48,15 @@ foreach(@lines) {
}

add_data0_if_not_present();
mount_all();
create_exports();

my %options;
GetOptions (
'reexport-only' => \$opt_reexport_only,
) or die $USAGE;
@ARGV and die $USAGE;

mount_all() unless $opt_reexport_only;
create_exports();
system("exportfs -ra");

sub safe_qx { open my $pipe,'-|',@_; return join('',<$pipe>) }
Expand Down

0 comments on commit 24b66dc

Please sign in to comment.