Re: Problems with a script when is launched via rgmanager (SOLVED)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/11/2011 06:59 AM, Fabio M. Di Nitto wrote:
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


Finally I have found the problem. I have setup splunk user with /sbin/nologin shell and I have changed to /bin/sh and the script works now.

Yes, I know that using exit 0 under status flag is dangerous, but I have configured like this to test the script first.

Many thanks.


--
CL Martinez
carlopmart {at} gmail {d0t} com

--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster


[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux