ABach Frequent Contributor.
Frequent Contributor.

"cluster status" from a script run by cron fails

I have a 2 node, OES2015.1 cluster.
One of the resources (GW POA) freezes, dies, stops etc. (exact description not yet known)
Cluster monitoring has been turned on and a line added for: rcgrpwise status post1.dom1

There are several TIDS/posts about writing your own scripts to control GroupWise if one does not want to use the GWHA features.
However, in my script I call cluster status to see if the resource is on this node before I check the POA status.
The script works fine from the console, but when I run it from crontab it says: cluster command not found

Here's the script:
# script to check POST1 status

# The following does not help

# The following does not help
# Add support for cluster commands
. /opt/novell/ncs/lib/ncsfuncs

# First, is the LUN15_SERVER Resource running here?
reshere=$(cluster status | egrep "LUN15_SERVER" | egrep "Running" | egrep "gw1" | wc -l)
# Is the POST1 Post Office Agent running?
poaup=$(ps ax | grep -v grep | grep "post1.poa" | wc -l)

if [ $reshere -ne 1 ]
echo "Resource NOT running here" >> /root/post1check.log 2>&1
elif [ $poaup -eq 1 ]
echo "All good!" >> /root/post1check.log 2>&1
echo "Resource Here but POA NOT running! - Restart Attempt" >> /root/post1check.log 2>&1
{ rcgrpwise status ; rcgrpwise start post1.dom1 ; rcgrpwise status; } | mail -s "GroupWise Status + Attempting Restart" serveradmin@company.ca

Here's my crontab:
*/5 * * * * /root/post1check.sh >> /root/post1check-cron.log 2>&1

post1check-cron.log says:
/root/post1check.sh: line 11: cluster: command not found

As you can see I tried to add some path and function support to my script with no luck.
Anyone have any ideas how to make the cluster command work?

Thanks in advance!
Labels (1)
2 Replies
ABach Frequent Contributor.
Frequent Contributor.

Re: "cluster status" from a script run by cron fails


After a disk search for anything called cluster, the solution was to use this format in the script


It's all working properly now.
Knowledge Partner
Knowledge Partner

Re: "cluster status" from a script run by cron fails

you'll likely need to specify the full path to the "cluster" command. think it's located in "/sbin".
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.