Yes I had, I checked it a lot of times :)

I managed to solve it after sending the output of my own application to a
log file, Finding a bug connected to environment setup,

Thanks A lot!
Eden.

On Fri, May 15, 2015 at 8:56 PM, Dejan Muhamedagic [via Linux-HA] <
ml-node+s996297n16197...@n3.nabble.com> wrote:

> Hi,
>
> On Tue, May 12, 2015 at 03:49:49AM -0700, Eden wrote:
> > Hi all,
> > I am trying to write my own resource agent service,
> > I have corosync + pacemaker + lcmc
> >
> > When I load the service it shows that it's running, Then after a few
> seconds
> > it stops,
> > I checked with a default resource agent (Dummy, sshd etc) and they work.
>
> Did you check out the Resource agents developer's guide?
>
> Cheers,
>
> Dejan
>
> > I'm running centos6.6 and these are the packages version:
> > corosync-1.4.7-1.el6.x86_64
> > corosynclib-1.4.7-1.el6.x86_64
> > pacemaker-1.1.12-4.el6.x86_64
> > pacemaker-cli-1.1.12-4.el6.x86_64
> > pacemaker-cluster-libs-1.1.12-4.el6.x86_64
> > pacemaker-libs-1.1.12-4.el6.x86_64
> >
> > When I look in ps I can see it actually starts the server but then it
> fall
> > again,
> >
> > This is my resource agent:
> >
> >
> > #!/bin/bash
> >
> > #######################################################################
> > # Initialization:
> > : ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
> > . ${OCF_FUNCTIONS}
> > : ${__OCF_ACTION=$1}
> >
> > #######################################################################
> >
> > meta_data() {
> > cat <<END
> > <?xml version="1.0"?>
> > <!DOCTYPE resource-agent SYSTEM &quot;ra-api-1.dtd&quot;>
> > <resource-agent name="Sqream" version="1.0">
> > <version>1.0</version>
> >
> > <longdesc lang="en">
> > sqream
> > </longdesc>
> > <shortdesc lang="en">sqream</shortdesc>
> > <parameters>
> >
> > <parameter name="pidfile" unique="0">
> > <longdesc lang="en">PID file</longdesc>
> > <shortdesc lang="en">PID file</shortdesc>
> > <content type="string"
> default="$HA_VARRUN/sqream-${OCF_RESOURCE_INSTANCE}"
> > />
> > </parameter>
> > </parameters>
> >
> > <actions>
> > <action name="start"        timeout="20" />
> > <action name="stop"         timeout="20" />
> > <action name="monitor"      timeout="20" interval="10" depth="0"/>
> > <action name="meta-data"    timeout="5" />
> > </actions>
> > </resource-agent>
> > END
> > }
> >
> > #######################################################################
> >
> > trap sigterm_handler TERM
> > sigterm_handler() {
> >         echo sigterm_handler >> /tmp/sqream_cluster.log
> > ocf_log info "They use TERM to bring us down. No such luck."
> > return
> > }
> >
> > sqream_usage() {
> > cat <<END
> > usage: $0
> > {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-data}
> >
> > END
> > }
> >
> > sqream_start() {
> >     sqream_monitor
> >     sleep 4
> >     /etc/init.d/sqream start
> >     if [ $? =  $OCF_SUCCESS ]; then
> > return $OCF_SUCCESS
> >     fi
> > }
> >
> > sqream_stop() {
> >     sqream_monitor
> >     sleep 2
> >     /etc/init.d/sqream stop
> >     return $OCF_SUCCESS
> > }
> >
> > sqream_monitor() {
> >
> > if pgrep &quot;sqreamd&quot; > /dev/null
> > then
> >    return 0
> > else
> >    return 7
> > fi
> > return $OCF_NOT_RUNNING
> > }
> >
> > sqream_validate() {
> >     date >> /tmp/sqream_cluster.log
> >     echo Validating >> /tmp/sqream_cluster.log
> >     # Is the state directory writable?
> >     state_dir=`dirname "$OCF_RESKEY_state"`
> >     touch "$state_dir/$$"
> >     if [ $? != 0 ]; then
> > return $OCF_ERR_ARGS
> >     fi
> >     rm "$state_dir/$$"
> >
> >     return $OCF_SUCCESS
> > }
> >
> > : ${OCF_RESKEY_fake=sqream}
> > : ${OCF_RESKEY_op_sleep=0}
> > : ${OCF_RESKEY_CRM_meta_interval=0}
> > : ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
> >
> > if [ "x$OCF_RESKEY_state" = "x" ]; then
> >     if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
> > state="${HA_VARRUN}/Sqream-${OCF_RESOURCE_INSTANCE}.state"
> >
> > # Strip off the trailing clone marker
> > OCF_RESKEY_state=`echo $state | sed s/:[0-9][0-9]*\.state/.state/`
> >     else
> > OCF_RESKEY_state="${HA_VARRUN}/Sqream-${OCF_RESOURCE_INSTANCE}.state"
> >     fi
> > fi
> >
> > case $__OCF_ACTION in
> > meta-data) meta_data
> > exit $OCF_SUCCESS
> > ;;
> > start) sqream_start;;
> > stop) sqream_stop;;
> > monitor) sqream_monitor;;
> > migrate_to) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to
> > ${OCF_RESKEY_CRM_meta_migrate_target}."
> >        sqream_stop
> > ;;
> > migrate_from) ocf_log info "Migrating ${OCF_RESOURCE_INSTANCE} to
> > ${OCF_RESKEY_CRM_meta_migrate_source}."
> >        sqream_start
> > ;;
> > reload) ocf_log err "Reloading..."
> >        sqream_start
> > ;;
> > validate-all) sqream_validate;;
> > usage|help) sqream_usage
> > exit $OCF_SUCCESS
> > ;;
> > *) sqream_usage
> > exit $OCF_ERR_UNIMPLEMENTED
> > ;;
> > esac
> > rc=$?
> > #ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
> > exit $rc
> >
> >
> >
> >
> > I would love some help,
> > Thanks a lot
> > Eden.
> >
> >
> >
> > --
> > View this message in context:
> http://linux-ha.996297.n3.nabble.com/Creating-A-resource-agent-tp16196.html
> > Sent from the Linux-HA mailing list archive at Nabble.com.
> > _______________________________________________
> > Linux-HA mailing list is closing down.
> > Please subscribe to [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=16197&i=0> instead.
> > http://clusterlabs.org/mailman/listinfo/users
> > _______________________________________________
> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=16197&i=1>
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha
> _______________________________________________
> Linux-HA mailing list is closing down.
> Please subscribe to [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=16197&i=2> instead.
> http://clusterlabs.org/mailman/listinfo/users
> _______________________________________________
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=16197&i=3>
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://linux-ha.996297.n3.nabble.com/Creating-A-resource-agent-tp16196p16197.html
>  To unsubscribe from Creating A resource agent, click here
> <http://linux-ha.996297.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=16196&code=ZWRlbkBzcXJlYW10ZWNoLmNvbXwxNjE5NnwtMjAzOTkxOTMzMA==>
> .
> NAML
> <http://linux-ha.996297.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://linux-ha.996297.n3.nabble.com/Creating-A-resource-agent-tp16196p16198.html
Sent from the Linux-HA mailing list archive at Nabble.com.
_______________________________________________
Linux-HA mailing list is closing down.
Please subscribe to us...@clusterlabs.org instead.
http://clusterlabs.org/mailman/listinfo/users
_______________________________________________
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha

Reply via email to