All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/gfs/scripts gfs_safe.pl
@ 2006-07-27 19:26 rohara
  0 siblings, 0 replies; only message in thread
From: rohara @ 2006-07-27 19:26 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rohara at sourceware.org	2006-07-27 19:26:25

Added files:
	gfs/scripts    : gfs_safe.pl 

Log message:
	Early version of a script to help users determine if a logical volume
	might be in use by another node. Useful to avoid doing a mkfs or fsck
	on a mounted filesystem.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/scripts/gfs_safe.pl.diff?cvsroot=cluster&r1=NONE&r2=1.1

/cvs/cluster/cluster/gfs/scripts/gfs_safe.pl,v  -->  standard output
revision 1.1
--- cluster/gfs/scripts/gfs_safe.pl
+++ -	2006-07-27 19:26:25.208429000 +0000
@@ -0,0 +1,84 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use vars qw($opt_e $opt_t $opt_v);
+
+use Getopt::Std;
+use IPC::Open3;
+
+if ($#ARGV < 0) {
+    print "$0: too few arguments.\n";
+    exit;
+}
+
+getopts('e:tv');
+
+my ($in, $out, $err, $cmd, $pid, $vol);
+
+$vol = $ARGV[$#ARGV];
+
+$cmd = "lvchange -a n $vol";
+$pid = open3($in, $out, $err, $cmd);
+
+waitpid($pid, 0);
+
+if ($?>>8)
+{
+    while (<$out>)
+    {
+	print "$_\n";
+    }
+    exit($?>>8);
+}
+else
+{
+    print "* Volume '$vol' is available for maintenance.\n";
+
+    if ($opt_t)
+    {
+	exit;
+    }
+
+    if ($opt_e)
+    {
+
+	$cmd = "lvchange -a ey $vol";
+	$pid = open3($in, $out, $err, $cmd);
+
+	waitpid($pid, 0);
+
+	if ($?>>8)
+	{
+	    while (<$out>)
+	    {
+		print "$_\n";
+	    }
+	    exit($?>>8);
+	}
+
+	$cmd = "$opt_e $vol";
+	print "$cmd\n";
+	$pid = open3($in, $out, $err, $cmd);
+
+	while (<$out>)
+	{
+	    print "$_";
+	}
+
+	waitpid($pid, 0);
+
+	$cmd = "lvchange -a en $vol";
+	$pid = open3($in, $out, $err, $cmd);
+
+	if ($?>>8)
+	{
+	    while (<$out>)
+	    {
+		print "$_\n";
+	    }
+	    exit($?>>8);
+	}
+    }
+    exit(0);
+}



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-27 19:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-27 19:26 [Cluster-devel] cluster/gfs/scripts gfs_safe.pl rohara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.