Rev 394: moved onnode into ctdb from s3 examples/ctdb in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Wed May 30 01:00:43 GMT 2007


------------------------------------------------------------
revno: 394
revision-id: tridge at samba.org-20070530010043-bgbx18q3o24ksgtn
parent: tridge at samba.org-20070530002116-kz22u8npsxt6hhom
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Wed 2007-05-30 11:00:43 +1000
message:
  moved onnode into ctdb from s3 examples/ctdb
added:
  tools/onnode.rsh               onnode.rsh-20070530010004-83j66tszzvsimcn2-1
  tools/onnode.ssh               onnode.ssh-20070530010004-83j66tszzvsimcn2-3
modified:
  packaging/RHEL/ctdb.spec       ctdb.spec-20070527204758-biuh7znabuwan3zn-3
=== added file 'tools/onnode.rsh'
--- a/tools/onnode.rsh	1970-01-01 00:00:00 +0000
+++ b/tools/onnode.rsh	2007-05-30 01:00:43 +0000
@@ -0,0 +1,43 @@
+#!/bin/sh
+# onnode script for rsh
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: onnode <nodenum|all> <command>
+EOF
+exit 1
+fi
+
+NODE="$1"
+shift
+SCRIPT="$*"
+
+NODES=/etc/ctdb/nodes
+
+NUMNODES=`egrep '^[[:alnum:]]' $NODES | wc -l`
+MAXNODE=`expr $NUMNODES - 1`
+
+if [ $NODE = "all" ]; then
+    for a in `egrep '^[[:alnum:]]' $NODES`; do
+	if [ -f "$SCRIPT" ]; then
+	    rsh $a at -f $SCRIPT now
+	else
+	    rsh $a $SCRIPT
+	fi
+    done
+    exit 0
+fi
+
+if [ $NODE -gt $MAXNODE ]; then
+    echo "Node $NODE doesn't exist"
+    exit 1
+fi
+
+NODEPLUSONE=`expr $NODE + 1`
+a=`egrep '^[[:alnum:]]' $NODES | head -$NODEPLUSONE | tail -1`
+
+if [ -f "$SCRIPT" ]; then
+    exec rsh $a at -f $SCRIPT now
+else
+    exec rsh $a $SCRIPT
+fi

=== added file 'tools/onnode.ssh'
--- a/tools/onnode.ssh	1970-01-01 00:00:00 +0000
+++ b/tools/onnode.ssh	2007-05-30 01:00:43 +0000
@@ -0,0 +1,43 @@
+#!/bin/sh
+# onnode script for ssh
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: onnode <nodenum|all> <command>
+EOF
+exit 1
+fi
+
+NODE="$1"
+shift
+SCRIPT="$*"
+
+NODES=/etc/ctdb/nodes
+
+NUMNODES=`egrep '^[[:alnum:]]' $NODES | wc -l`
+MAXNODE=`expr $NUMNODES - 1`
+
+if [ $NODE = "all" ]; then
+    for a in `egrep '^[[:alnum:]]' $NODES`; do
+	if [ -f "$SCRIPT" ]; then
+	    ssh $a at -f $SCRIPT now
+	else
+	    ssh $a $SCRIPT
+	fi
+    done
+    exit 0
+fi
+
+if [ $NODE -gt $MAXNODE ]; then
+    echo "Node $NODE doesn't exist"
+    exit 1
+fi
+
+NODEPLUSONE=`expr $NODE + 1`
+a=`egrep '^[[:alnum:]]' $NODES | head -$NODEPLUSONE | tail -1`
+
+if [ -f "$SCRIPT" ]; then
+    exec ssh $a at -f $SCRIPT now
+else
+    exec ssh $a $SCRIPT
+fi

=== modified file 'packaging/RHEL/ctdb.spec'
--- a/packaging/RHEL/ctdb.spec	2007-05-29 12:53:28 +0000
+++ b/packaging/RHEL/ctdb.spec	2007-05-30 01:00:43 +0000
@@ -66,6 +66,9 @@
 install -m644 setup/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb
 install -m755 setup/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
 install -m755 tools/events $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events
+install -m755 tools/onnode.ssh $RPM_BUILD_ROOT%{_bindir}
+install -m755 tools/onnode.rsh $RPM_BUILD_ROOT%{_bindir}
+ln -sf %{_bindir}/onnode.ssh onnode
 
 # unfortunately samba3 needs ctdb_private.h too
 install -m644 include/ctdb_private.h %{_includedir}/ctdb_private.h



More information about the samba-cvs mailing list