I have created the following test script to run through RMA, but am getting an error when I try and insert any if...else, or two ifs in a script. I am runnning on Solaris 2.8 (Sparc)
Below is a test script:
--------------------Script----------------
#/bin/sh
PCOUNT=`vmstat|tail -1|awk '{print $5}'`
if [ $PCOUNT -lt $1 ]
then
echo ScriptRes:Ok:$PCOUNT
fi
--------------------------------------------
which gives the following result
-----------------Result--------------------
[4:49:44 PM] Agent: ITSPARKY is going to execute "Test Script" script ...
[4:49:45 PM] Script executed, correct result received:
----------
- Status: Ok
- Reply: 43968
----------
-------------------------------------------
Now, when I try this script:
----------------------Script----------------
#/bin/sh
PCOUNT=`vmstat|tail -1|awk '{print $5}'`
if [ $PCOUNT -lt $1 ]
then
echo ScriptRes:Ok:$PCOUNT
else
echo ScriptRes:Bad:$PCOUNT
fi
----------------------------------------------
it errors with the following:
---------------------Result------------------
[4:52:56 PM] Agent: ITSPARKY is going to execute "Test Script" script ...
[4:52:56 PM] Agent error: Cannot read data
----------------------------------------------
Nothing changes except the addition of the else clause. Also, all of the scripts that came with HA are failing with the same error through RMA but will run in a shell window on the box.
Any ideas?
Solaris Scripting with RMA Issues
We experienced similar problem when developed agent. Problem appeared because Windows uses \r\n to separate lines (HostMonitor is Windows application).
That's why RMA for UNIX replaces \r\n to \n in any script received from HostMointor. This behavior was implemented in first version of the agent, I wonder why you experience problem...
We checked all scripts on Sparc system before release... Unfortunately I cannot check this again because we rented Sparc station.
If you don't change scripts often, you may locate (and edit) scripts on Sparc station and use HostMonitor's Script Manager to execute script.
Regards
Alex
That's why RMA for UNIX replaces \r\n to \n in any script received from HostMointor. This behavior was implemented in first version of the agent, I wonder why you experience problem...
Have no ideaNothing changes except the addition of the else clause. Also, all of the scripts that came with HA are failing with the same error through RMA but will run in a shell window on the box.

If you don't change scripts often, you may locate (and edit) scripts on Sparc station and use HostMonitor's Script Manager to execute script.
Regards
Alex