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:
Read in a variable the name of the current node (uname ... ?!?)
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:
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?
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:
Read in a variable the name of the current node (uname ... ?!?)
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:
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?
I made a small test script - just the same bunch of commands inside a script. I can't remember the error messages exactly and right now I can't connect on that sparcs... when I can log in ... I'll post the entire output...
BTW there is a command to print the both node names like: