[Linux-cluster] Problems with a script when is launched via rgmanager

Fabio M. Di Nitto fdinitto at redhat.com
Tue Jan 11 05:59:11 UTC 2011


On 01/10/2011 10:16 PM, carlopmart wrote:
> Hi all,
> 
>  I am trying to set up a splunk cluster service on two RHEL5.5 hosts
> (fully updated). My problems becomes when I trying to setup this service
> under rgmanager: script ever fails. If I launch the script manually, all
> works as expected. If I test the service using rg_test comand, all works
> ok as expected.

Do you have selinux enabled? If so you probably need to allow rgmanager
to run the service or set selinux in permissive mode and check for avc.

> #!/bin/sh -x
> # Splunk:       Controls Splunk on Redhat-based systems
> #
> # chkconfig: 2345 99 15
> # description: Starts and stops Splunk
> #
> # This will work on Redhat systems (maybe others too)
> 
> # Source function library.
> . /etc/init.d/functions
> 
> if [ ! -d /data/services/siem/splunk/etc ]; then
>         exit 1
> fi
> 
> HOME="/data/services/siem/splunk"
> DIRECTORY="/data/services/siem/splunk"
> 
> export HOME
> 
> 
> 
> start() {
>         echo -n "Starting Splunk: "
>         sudo -H -u splunk ${DIRECTORY}/bin/splunk start > /dev/null
>         RETVAL=$?
>         if [ $RETVAL -eq 0 ]; then
>                 success
>         else
>                 failure
>         fi
>         echo
>         return $RETVAL
> }
> 
> stop() {
>         echo -n "Stopping Splunk: "
>         sudo -H -u splunk ${DIRECTORY}/bin/splunk stop > /dev/null
>         RETVAL=$?
>         if [ $RETVAL -eq 0 ]; then
>                 success
>         else
>                 failure
>         fi
>         echo
>         return $RETVAL
> }
> 
> status() {
>         exit 0
> }
> 
> case "$1" in
>   start)
>         start
>         ;;
>   stop)
>         stop
>         ;;
>   restart)
>         stop
>         start
>         ;;
>   status)
>         status
>         ;;
>   *)
>         echo $"Usage: $0 {start|stop|restart|status}"
>         exit 1
> esac
> 
> exit $?
> 
> 
>  How can I debug this error?? I don't why fails when is launched via
> rgmanager ...
> 

This script is dangerous. It doesn't implement a proper status check,
returning always 0. rgmanager will not be able to monitor the status of
the application and in case of application failure, it cannot take any
action to recover it.

Fabio




More information about the Linux-cluster mailing list