Sponsored Content
Top Forums Shell Programming and Scripting The other node name of a SUN cluster Post 302092294 by heartwork on Sunday 8th of October 2006 12:54:47 PM
Old 10-08-2006
The other node name in a SUN cluster

Hello,

Under ksh I have to run a script on one of the nodes of a Solaris 8 cluster which at some time must execute a command on the alternate node:
# rsh <name> "command"

I have to implement this script on all the clusters of my company (a lot of...).
Fortunately, the names of the two nodes obey the following rule: a common string excepting the last character which is 1 on one node and 2 for the other.
I don't want to read the names of the machines in /etc/hosts which is really a mess on some clusters... (obsolete names etc.)

I thought to the following solution:

1. Read in a variable the name of the current node (uname ... ?!?)

2. In the script I added a part that get from the current node name the other node name. From some reason... when I run from the ksh the commands one by one it works fine:

Code:
root@carp # X=abc12
root@carp # numofchar=${#X}
root@carp # numofcharminus1=`expr $numofchar "-" 1`
root@carp # Y=`echo "$X" | cut -c1-${numofcharminus1}`
root@carp # Z=`echo "$X" | cut -c${numofchar}`
root@carp # T=`expr 3 "-" $Z`
root@carp # echo $Y$T
abc11

but when I insert them in the script I got error messages like:

Y=`echo "$X" | cut -c1-${numofcharminus1}`
cut - invalid range

T=`expr 3 "-" $Z`
invalid expression

I don't use scripting too often but I can't see what's wrong in my solution... a CR rule/type conversion... I am too tired and I must finish it until tommorow so please can someone help me! Maybe someone forsee another solution?

Regards

Last edited by heartwork; 10-08-2006 at 04:18 PM..
 

9 More Discussions You Might Find Interesting

1. HP-UX

Node can't join cluster

Need help guys! when running cmrunnode batch i'm getting this error cmrunnode : Waiting for cluster to... (1 Reply)
Discussion started by: Tris
1 Replies

2. HP-UX

MC/SG Fail to join cluster node

Hi, Please advise me whereas I have two node cluster server configured with MC/SG. Application and DB are running on Node 1, while Node 2 is standby. All the volume group devices are part of cluster environment. There is only one package running at node 1. Node 2 is having the problem to... (1 Reply)
Discussion started by: rauphelhunter
1 Replies

3. High Performance Computing

Setting up 2 node cluster using solaris 10

hi, i am trying to setup a 2 node cluster environment. following is what i have; 1. 2 x sun ultra60 - 450MHz procs, 1GB RAM, 9GB HDD, solaris 10 2. 2 x HBA cards 3. 2 x Connection leads to connect ultra60 with D1000 4. 1 x D1000 storage box. 5. 3 x 9GB HDD + 2 x 36GB HDD first of all,... (1 Reply)
Discussion started by: solman17
1 Replies

4. Solaris

Active Sun cluster node?

I now the logical name and Virtual IP of the cluster. How can I find the active sun cluster node without having root access? (3 Replies)
Discussion started by: sreeniatbp
3 Replies

5. Solaris

Single node Sun Cluster with zones

How can we add a shared zfs dataset between 2 zones on a same host. I have sun cluster 3.2 installed in a server which has 2 zones. I want to share a zfs data set between these 2 zones how can we do that ? (7 Replies)
Discussion started by: fugitive
7 Replies

6. Solaris

SVM metaset on 2 node Solaris cluster storage replicated to non-clustered Solaris node

Hi, Is it possible to have a Solaris cluster of 2 nodes at SITE-A using SVM and creating metaset using say 2 LUNs (on SAN). Then replicating these 2 LUNs to remote site SITE-B via storage based replication and then using these LUNs by importing them as a metaset on a server at SITE-B which is... (0 Replies)
Discussion started by: dn2011
0 Replies

7. Solaris

Sun Cluster 3.2 x86: Node is rebooting itself

Hey Admins, I am running sun cluster 3.2 x86 on Vmware. I m facing an issue from 2 days.. One main node is continuously rebooting..... not sure... whats woring... I just had change heartbeat timeout values on 1 this node... Now both node are just rebooting itself..seems panic.. Any... (1 Reply)
Discussion started by: snchaudhari2
1 Replies

8. Solaris

Sun cluster 4.0 - zone cluster failover doubt

Hello experts - I am planning to install a Sun cluster 4.0 zone cluster fail-over. few basic doubts. (1) Where should i install the cluster s/w binaries ?. ( global zone or the container zone where i am planning to install the zone fail-over) (2) Or should i perform the installation on... (0 Replies)
Discussion started by: NVA
0 Replies

9. AIX

Cluster node not starting

Setting up HACMP 6.1 on a two node cluster. The other node works fine and can start properly on STABLE state (VGs varied, FS mounted, Service IP aliased). However, the other node is always stuck on ST_JOINING state. Its taking forever and you can't stop the cluster as well or recover from script... (2 Replies)
Discussion started by: depam
2 Replies
cmdeleteconf(1m)														  cmdeleteconf(1m)

NAME
cmdeleteconf - Delete either the cluster or the package configuration SYNOPSIS
cmdeleteconf [-f] [-v] [-c cluster_name] [[-p package_name]...] DESCRIPTION
cmdeleteconf deletes either the entire cluster configuration, including all its packages, or only the specified package configuration. If neither cluster_name nor package_name is specified, cmdeleteconf will delete the local cluster's configuration and all its packages. If the local node's cluster configuration is outdated, cmdeleteconf without any argument will only delete the local node's configuration. If only the package_name is specified, the configuration of package_name in the local cluster is deleted. If both cluster_name and pack- age_name are specified, the package must be configured in the cluster_name, and only the package package_name will be deleted. cmdelete- conf with only cluster_name specified will delete the entire cluster configuration on all the nodes in the cluster, regardless of the con- figuration version. The local cluster is the cluster that the node running the cmdeleteconf command belongs to. Only a superuser, whose effective user ID is zero (see id(1) and su(1)), can delete the configuration. To delete the cluster configuration, halt the cluster first. To delete a package configuration you must halt the package first, but you do not need to halt the cluster (it may remain up or be brought down). To delete the package VxVM-CVM-pkg (HP-UX only), you must first delete all packages with STORAGE_GROUP defined. While deleting the cluster, if any of the cluster nodes are powered down, the user can choose to continue deleting the configuration. In this case, the cluster configuration on the down node will remain in place and, therefore, be out of sync with the rest of the cluster. If the powered-down node ever comes up, the user should execute the cmdeleteconf command with no argument on that node to clean up the config- uration before doing any other Serviceguard command. Options cmdeleteconf supports the following options: -f Force the deletion of either the cluster configuration or the package configuration. -v Verbose output will be displayed. -c cluster_name Name of the cluster to delete. The cluster must be halted already, if intending to delete the cluster. -p package_name Name of an existing package to delete from the cluster. The package must be halted already. There should not be any packages in the cluster with STORAGE_GROUP defined before having a package_name of VxVM-CVM-pkg (HP-UX only). RETURN VALUE
Upon completion, cmdeleteconf returns one of the following values: 0 Successful completion. 1 Command failed. EXAMPLES
The high availability environment contains the cluster, clusterA , and a package, pkg1. To delete package pkg1 in clusterA, do the following: cmdeleteconf -f -c clusterA -p pkg1 To delete the cluster clusterA and all its packages, do the following: cmdeleteconf -f -c clusterA AUTHOR
cmdeleteconf was developed by HP. SEE ALSO
cmcheckconf(1m), cmapplyconf(1m), cmgetconf(1m), cmmakepkg(1m), cmquerycl(1m). Requires Optional Serviceguard Software cmdeleteconf(1m)
All times are GMT -4. The time now is 08:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy