cancel
Showing results for 
Search instead for 
Did you mean: 

Custom resource /agent help

Andy_M
Level 3

Hi All

I'm running a 2 node VRTSvcs 4.1 on Solaris 8.

I've created 2 custom resources , one's an apache web server and the other is a Mysql Db.

I've followed the instructions in the  vcs-agent-developers guide and created the relevant directories and shell scripts.

The scripts are identical for the web server and for apache, but the Mysql db online script doesn’t seem to get called or is not working correctly on cluster start. The Apache resource /agent work fine.

If I manually start the mysql resource; once running , I can then use the hares commands to stop and start it- no problem. It only wont start when I issue the hastart on each node.

All I am doing is passing the path of the start-up script to the agent and running a start  and stop. The monitor scripts for both web server and apache are running  pgrep's.

I cant figure why the Mysql resource/agent doesn’t start but the Apache one does; I dont know where to find further debugging info , can anyone help ?

Here are snippets from my config.

main.cf
Apache_httpd andy_httpd (
               ScriptPath = "/etc/rc2.d/S77apache "
               )
Mysql intergrate-db (
               ScriptPath = "/etc/rc2.d/S78mysql "
               )
types.cf
type Apache_httpd (
       str Httpd-resource
       str ScriptPath
       static str ArgList[] = { ScriptPath }
)
type Mysql (
       str Mysql-db
       str ScriptPath
       static str ArgList[] = { ScriptPath }
)

agent code for the web resource
# more online
#!/bin/sh
# Apache startup
echo "\nStarting: $2 start\n" >> /opt/VRTSvcs/bin/Apache_httpd/log
echo "Apache starting`date`    $0
$@\n" >> /opt/VRTSvcs/bin/Apache_httpd/log
$2 start
 
 # more offline
#!/bin/sh
#Apache shutdown
echo "Apache shutdown `date`    $0 $@" >> /opt/VRTSvcs/bin/Apache_httpd/log
$2 stop
 
# more monitor
#!/bin/sh
if /usr/bin/pgrep -x -u 0 -P 1 httpd >/dev/null 2>&1;
then exit 110;
else exit 100;
fi
 
agent code for Mysql resource
# more online
#!/bin/sh
# Mysql startup
echo "\nMysql starting`date`    $0 $@" >> /opt/VRTSvcs/bin/Mysql/log
echo "\nRunning: $2 start" >> /opt/VRTSvcs/bin/Mysql/log
$2 start
 
# more offline
#!/bin/sh
#Mysql shutdown
echo "Mysql shutdown `date`    $0
$@\n" >> /opt/VRTSvcs/bin/Mysql/log
$2 stop
 
# more monitor
#!/bin/sh
if /usr/bin/pgrep  mysqld >/dev/null 2>&1;
then exit 110;
else exit 100;
fi
 
 
Any help would be great.
Regards
Andy
 
3 REPLIES 3

Gene_Henriksen
Level 6
Accredited Certified
A couple of comments:
1) You did not include the Service Group info. Are these in different Service Groups? If so do they both contain a system name in the AutoStartList? Can you run "hares -online MySQL -sys <servername>" and have it come online?

2) Why did you leave the startup scripts in rc2.d? The OS will attempt to start the apps and will be at odds with VCS.

3) This might have been much simpler with the Application Resource Type (which is supported in case you have issues).

Andy_M
Level 3
Many thanks Gene
 
You've made me aware of some issues I didn't think about.
 
More reading I think !
 
 
 

Eric_Hennessey1
Level 5
Employee Certified
I would definitely consider Gene's advice on using the Application resource.  First, rename the rc2.d mysql script so it doesn't start at boot...I usually just change the upper case S to a lower case s.

You can then achieve the same desired result as what your custom agent would provide by configuring an Application resource as follows:

StartProgram = /etc/rc2.d/s78mysql start
StopProgram = /etc/rc2.d/s78mysql stop
Processes = httpd

Eric