1 2 Previous Next 18 Replies Latest reply: Jul 18, 2013 3:54 AM by user10501597 RSS

    Can not start/enable the service

    user10501597

      I've posted the same post by LinuxQustions.org. Since I haven't got answer for days, I try here. Here is the link of my question. Hope the admin will not think I post my question anywgere.

       

      http://www.linuxquestions.org/questions/solaris-opensolaris-20/can-not-start-enable-the-service-4175469250/

        • 1. Re: Can not start/enable the service
          Pascal Kreyer -Oracle

          Please, don't use a pointer to explain what is your problem or questions. This will be difficult to help you if the source website get down.

           

          Based on the problem description you wrote in the other site and on the error messages, this is not an issue in the SMF but more in the executable that the SMF starts. Please start /lib/svc/method/wsvws manually and check if the problem is still there. When yes, the problem is in this script or in what it starts.

          • 2. Re: Can not start/enable the service
            user10501597

            Hi,

             

            If I post my original question here, the admin will say I've posted the same by the other Forum and will lock my post.

             

            Ok, now to my question: I've started the /lib/svc/method/test (I renamed the wsvws to test) manually without any problem. I've simplified my script as follow:

             

            [code]

            #!/bin/bash

            #

             

             

            start() {

              echo strting ...

            }

             

             

            stop() {

              echo stopping ...

            }

             

             

            case "$1" in

              start)

                  start

                  ;;

              stop)

                  stop

                  ;;

              restart)

                  $0 stop

                  $0 start

                  ;;

              status)

                  status

                  ;;

              cleanup)

                  cleanup

                  ;;

              *)

                  ## If no parameters are given, print which are avaiable.

                  echo "Usage: $0 {start|stop|status|restart|reload|cleanup}"

                  exit 1

                  ;;

            esac

            [/code]

             

            This is a very simple and basic script.

             

            And here again my manifest test.xml:

            [code]

            <?xml version="1.0" encoding="UTF-8"?>

            <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

            <service_bundle type='manifest' name='test'>

              <service name='application/jboss/test' type='service' version='1'>

              <create_default_instance enabled='false' />

              <single_instance />

              <exec_method type='method' name='start' exec='/lib/svc/method/test start'

              timeout_seconds='60' />

              <exec_method type='method' name='stop' exec='/lib/svc/method/test stop'

              timeout_seconds='60' />

              <exec_method type='method' name='restart' exec='/lib/svc/method/test restart' timeout_seconds='60' />

              <stability value='Evolving' />

              <template>

              <common_name>

              <loctext xml:lang='C'>test service</loctext>

              </common_name>

              </template>

             

              </service>

            </service_bundle>

            [/code]

             

            I think this is a very basic manifest.

             

            First I validate and import the manifest into SMF with 'svccfg validate test.xml' and 'svccfg import test.xml'.

             

            Then I start the service with 'svcadm validate test'. But I can see in the log file the service will be started and stopped many times and at last it was turned to the maintenance mode. Here is what I get in nthe log:

            [code]

            [ Jul 15 10:41:28 Disabled. ]

            [ Jul 15 10:41:28 Rereading configuration. ]

            [ Jul 15 10:42:24 Enabled. ]

            [ Jul 15 10:42:24 Executing start method ("/lib/svc/method/test start") ]

            strting ...

            [ Jul 15 10:42:24 Method "start" exited with status 0 ]

            [ Jul 15 10:42:24 Stopping because all processes in service exited. ]

            [ Jul 15 10:42:24 Executing stop method ("/lib/svc/method/test stop") ]

            stopping ...

            [ Jul 15 10:42:24 Method "stop" exited with status 0 ]

            [ Jul 15 10:42:24 Executing start method ("/lib/svc/method/test start") ]

            strting ...

            [ Jul 15 10:42:24 Method "start" exited with status 0 ]

            [ Jul 15 10:42:24 Stopping because all processes in service exited. ]

            [ Jul 15 10:42:24 Executing stop method ("/lib/svc/method/test stop") ]

            stopping ...

            [ Jul 15 10:42:24 Method "stop" exited with status 0 ]

            [ Jul 15 10:42:24 Executing start method ("/lib/svc/method/test start") ]

            strting ...

            [ Jul 15 10:42:24 Method "start" exited with status 0 ]

            [ Jul 15 10:42:24 Stopping because all processes in service exited. ]

            [ Jul 15 10:42:24 Executing stop method ("/lib/svc/method/test stop") ]

            stopping ...

            [ Jul 15 10:42:24 Method "stop" exited with status 0 ]

            [ Jul 15 10:42:24 Executing start method ("/lib/svc/method/test start") ]

            strting ...

            [ Jul 15 10:42:24 Method "start" exited with status 0 ]

            [ Jul 15 10:42:24 Stopping because all processes in service exited. ]

            [ Jul 15 10:42:24 Executing stop method ("/lib/svc/method/test stop") ]

            stopping ...

            [ Jul 15 10:42:24 Method "stop" exited with status 0 ]

            [ Jul 15 10:42:24 Restarting too quickly, changing state to maintenance ]

            [/code]

             

             

            I couldn't find any error in my scripts and manifest.

            • 3. Re: Can not start/enable the service
              Pascal Kreyer -Oracle

              SMF is basically build for daemon execution because it monitor it. If you try to run a non-daemon like an echo command, then you should set your SMF as a "transient" service.

               

              Example : http://docs.oracle.com/cd/E23824_01/html/E21798/firstboot-2.html

              • 4. Re: Can not start/enable the service
                984266

                Well, at the end you need to have

                 

                exit $SMF_EXIT_OK

                 

                in your script

                • 5. Re: Can not start/enable the service
                  user10501597

                  Ok, you are right.

                   

                  Now I come back to the original manifest '/var/svc/manifest/application/jboss/wsvws.xml' and script.

                   

                  The 'wsvws.xml' looks as follow (almost the same and simple as test.xml'):

                  [code]

                  <?xml version="1.0" encoding="UTF-8"?>

                  <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">

                  <service_bundle type='manifest' name='wsvws'>

                    <service name='application/jboss/wsvws' type='service' version='1'>

                    <create_default_instance enabled='false' />

                    <single_instance />

                    <method_context>

                    <method_credential user='wsvws' group='jboss' />

                    </method_context>

                    <exec_method type='method' name='start' exec='/lib/svc/method/wsvws start'

                    timeout_seconds='60' />

                    <exec_method type='method' name='stop' exec='/lib/svc/method/wsvws stop'

                    timeout_seconds='60' />

                    <exec_method type='method' name='restart'

                    exec='/lib/svc/method/wsvws restart' timeout_seconds='60' />

                    <stability value='Evolving' />

                    <template>

                    <common_name>

                    <loctext xml:lang='C'>wsvws service</loctext>

                    </common_name>

                    </template>

                   

                    </service>

                  </service_bundle>

                  [/code]

                   

                  And the init-script (/lib/svc/method/wsvws) look as follow. It's an init-script to start and stop the Jboss which as daemon installed.

                  [code]

                  #!/bin/bash

                  #

                  # JBoss standalone SOE control script

                  # Adapted from standard JBoss standalone control script

                  #

                  # chkconfig: - 80 20

                  # description:                  JBoss AS Profile wsvws Standalone

                  # processname:                  standalone-wsvws

                  # pidfile:                      /var/run/jboss-as/jboss-$PROFILE.pid

                  # config (dynamically created): /opt/jboss-apps/wsvws/configuration/jboss_wsvws_sysconfig

                   

                   

                  # Source function library.

                  #. /etc/init.d/functions

                   

                   

                  # Load Java configuration.

                  [ -r /etc/java/java.conf ] && . /etc/java/java.conf

                  export JAVA_HOME

                   

                   

                  # Load JBoss AS init.d configuration.

                  if [ -z "$JBOSS_CONF" ]; then

                    JBOSS_CONF="/opt/jboss-apps/wsvws/configuration/jboss_wsvws_sysconfig"

                  fi

                   

                   

                  [ -r "$JBOSS_CONF" ] && source ${JBOSS_CONF}

                   

                   

                  # Set defaults.

                   

                   

                  if [ -z "$JBOSS_PIDFILE" ]; then

                    JBOSS_PIDFILE=/var/run/jboss-as/jboss-as-standalone.pid

                  fi

                  export JBOSS_PIDFILE

                   

                   

                  if [ -z "$JBOSS_CONSOLE_LOG" ]; then

                    JBOSS_CONSOLE_LOG=/var/log/jboss-as/console.log

                  fi

                   

                   

                  if [ -z "$JBOSS_SERVER_LOG" ]; then

                    JBOSS_SERVER_LOG=/var/log/jboss-as/server.log

                  fi

                   

                   

                  if [ -z "$STARTUP_WAIT" ]; then

                    STARTUP_WAIT=30

                  fi

                   

                   

                  if [ -z "$SHUTDOWN_WAIT" ]; then

                    SHUTDOWN_WAIT=30

                  fi

                   

                   

                  if [ -z "$JBOSS_CONFIG" ]; then

                    JBOSS_CONFIG=standalone.xml

                  fi

                   

                   

                  if [ -z "$JBOSS_USER" ]; then

                    JBOSS_USER=jboss

                  fi

                   

                   

                  JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh

                   

                   

                  prog='jboss-as'

                   

                   

                  CMD_PREFIX=''

                   

                   

                  if [ ! -z "$JBOSS_USER" ]; then

                    if [ -e /etc/rc.d/init.d/functions ]; then

                      CMD_PREFIX="daemon --user $JBOSS_USER"

                    else

                      CMD_PREFIX="su - $JBOSS_USER -c"

                    fi

                  fi

                   

                   

                  start() {

                   

                   

                    echo -n "Starting $prog ... "

                    if [ -f $JBOSS_PIDFILE ]; then

                      read ppid < $JBOSS_PIDFILE

                      if [ `ps -p $ppid 2> /dev/null | grep -c $ppid 2> /dev/null` -eq '1' ]; then

                        echo -n "$prog is already running"

                  #      failure

                        echo [FAILED]

                        return 1

                      else

                        rm -f $JBOSS_PIDFILE

                      fi

                    fi

                   

                  # Clean up cache

                    $0 cleanup

                   

                   

                    mkdir -p $(dirname $JBOSS_CONSOLE_LOG)

                    chown $JBOSS_USER:jboss $(dirname $JBOSS_CONSOLE_LOG)

                    cat /dev/null > $JBOSS_CONSOLE_LOG

                   

                   

                    mkdir -p $(dirname $JBOSS_PIDFILE)

                    chown $JBOSS_USER $(dirname $JBOSS_PIDFILE) || true

                    #$CMD_PREFIX JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT 2>&1 > $JBOSS_CONSOLE_LOG &

                    #$CMD_PREFIX JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT &

                   

                   

                    if [ ! -z "$JBOSS_USER" ]; then

                      if [ -e /etc/rc.d/init.d/functions ]; then

                        daemon --user $JBOSS_USER LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_MODULEPATH=$JBOSS_MODULEPATH JBOSS_BASE_DIR=$JBOSS_BASE_DIR RUN_CONF=$RUN_CONF JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT -c $JBOSS_CONFIG -P $JBOSS_BASE_DIR/configuration/wsvws.properties 2>&1 > $JBOSS_CONSOLE_LOG &

                      else

                        su - $JBOSS_USER -c "LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_MODULEPATH=$JBOSS_MODULEPATH JBOSS_BASE_DIR=$JBOSS_BASE_DIR RUN_CONF=$RUN_CONF JBOSS_PIDFILE=$JBOSS_PIDFILE $JBOSS_SCRIPT -c $JBOSS_CONFIG -P $JBOSS_BASE_DIR/configuration/wsvws.properties" 2>&1 > $JBOSS_CONSOLE_LOG &

                      fi

                    fi

                   

                   

                    count=0

                    launched=false

                    skip_lines=0

                   

                   

                    if [ -f $JBOSS_SERVER_LOG ] ; then

                      skip_lines=$(cat $JBOSS_SERVER_LOG | wc -l)

                    fi

                   

                   

                    echo "skipping $skip_lines lines of $JBOSS_SERVER_LOG"

                   

                   

                    sleep 2

                   

                   

                    until [ $count -gt $STARTUP_WAIT ]

                    do

                  #    tail -n+$skip_lines $JBOSS_SERVER_LOG | grep 'JBoss EAP.*started in' > /dev/null

                      tail -5 $JBOSS_SERVER_LOG | grep 'JBoss EAP.*started in' > /dev/null

                      if [ $? -eq 0 ] ; then

                        launched=true

                        break

                      fi

                      sleep 1

                      let count=$count+1;

                    done

                   

                   

                    if [ $launched == true ] ; then

                  #    success

                      echo [OK]

                      return 0

                    else

                  #    failure

                      echo [FAILED]

                      return 1

                    fi

                  }

                   

                   

                  stop() {

                    echo -n $"Stopping $prog... "

                    count=0;

                   

                   

                    if [ -f $JBOSS_PIDFILE ]; then

                      read kpid < $JBOSS_PIDFILE

                      let kwait=$SHUTDOWN_WAIT

                   

                   

                      # Try issuing SIGTERM

                   

                   

                      kill -15 $kpid

                      until [ `ps -p $kpid 2> /dev/null | grep -c $kpid 2> /dev/null` -eq '0' ] || [ $count -gt $kwait ]

                      do

                        sleep 1

                        let count=$count+1;

                      done

                   

                   

                      if [ $count -gt $kwait ]; then

                        kill -9 $kpid

                      fi

                    fi

                    rm -f $JBOSS_PIDFILE

                  #  success

                    echo Jboss is stopped.

                  }

                   

                   

                  status() {

                    if [ -f $JBOSS_PIDFILE ]; then

                      read ppid < $JBOSS_PIDFILE

                      if [ `ps -p $ppid 2> /dev/null | grep -c $ppid 2> /dev/null` -eq '1' ]; then

                        echo "$prog is running (pid $ppid)"

                        return 0

                      else

                        echo "$prog dead but pid file exists"

                        return 1

                      fi

                    fi

                    echo "$prog is not running"

                    return 3

                  }

                   

                   

                  cleanup() {

                    if [ -f $JBOSS_PIDFILE ]; then

                      echo -n "JBoss is still running. Please stop the server first."

                      echo

                      return 1

                    else

                      echo cleaning the cache ...

                      if [ ! -z "$JBOSS_BASE_DIR" ] && [ -d "$JBOSS_BASE_DIR/tmp" ]; then

                    rm -rf $JBOSS_BASE_DIR/tmp

                        echo $JBOSS_BASE_DIR/tmp is deleted

                      else

                        echo $JBOSS_BASE_DIR/tmp not exist

                      fi

                   

                   

                      if [ ! -z "$JBOSS_BASE_DIR" ] && [ -d "$JBOSS_BASE_DIR/data" ]; then

                        rm -rf $JBOSS_BASE_DIR/data

                        echo $JBOSS_BASE_DIR/data is deleted

                      else

                        echo $JBOSS_BASE_DIR/data not exist

                      fi

                    fi

                   

                   

                  }

                   

                   

                  case "$1" in

                    start)

                        start

                        ;;

                    stop)

                        stop

                        ;;

                    restart)

                        $0 stop

                        $0 start

                        ;;

                    status)

                        status

                        ;;

                    cleanup)

                        cleanup

                        ;;

                    *)

                        ## If no parameters are given, print which are avaiable.

                        echo "Usage: $0 {start|stop|status|restart|reload|cleanup}"

                        exit 1

                        ;;

                  esac

                  [/code]

                   

                  The following is what I got from the '/var/svc/log/application-jboss-wsvws:default.log':

                  [code]

                  [ Jul 15 12:02:20 Disabled. ]

                  [ Jul 15 12:02:20 Rereading configuration. ]

                  [ Jul 15 12:02:46 Enabled. ]

                  [ Jul 15 12:02:46 Executing start method ("/lib/svc/method/wsvws start") ]

                  Starting jboss-as ... cleaning the cache ...

                  /opt/jboss-apps/wsvws/tmp is deleted

                  /opt/jboss-apps/wsvws/data is deleted

                  /lib/svc/method/wsvws: line 92: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  /lib/svc/method/wsvws: line 103: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  skipping      54 lines of /var/log/jboss-apps/wsvws/server.log

                  [OK]

                  [ Jul 15 12:02:48 Method "start" exited with status 0 ]

                  [ Jul 15 12:02:48 Stopping because all processes in service exited. ]

                  [ Jul 15 12:02:48 Executing stop method ("/lib/svc/method/wsvws stop") ]

                  Stopping jboss-as... Jboss is stopped.

                  [ Jul 15 12:02:48 Method "stop" exited with status 0 ]

                  [ Jul 15 12:02:48 Executing start method ("/lib/svc/method/wsvws start") ]

                  Starting jboss-as ... cleaning the cache ...

                  /opt/jboss-apps/wsvws/tmp not exist

                  /opt/jboss-apps/wsvws/data not exist

                  /lib/svc/method/wsvws: line 92: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  /lib/svc/method/wsvws: line 103: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  skipping      54 lines of /var/log/jboss-apps/wsvws/server.log

                  [OK]

                  [ Jul 15 12:02:50 Method "start" exited with status 0 ]

                  [ Jul 15 12:02:50 Stopping because all processes in service exited. ]

                  [ Jul 15 12:02:50 Executing stop method ("/lib/svc/method/wsvws stop") ]

                  Stopping jboss-as... Jboss is stopped.

                  [ Jul 15 12:02:50 Method "stop" exited with status 0 ]

                  [ Jul 15 12:02:50 Executing start method ("/lib/svc/method/wsvws start") ]

                  Starting jboss-as ... cleaning the cache ...

                  /opt/jboss-apps/wsvws/tmp not exist

                  /opt/jboss-apps/wsvws/data not exist

                  /lib/svc/method/wsvws: line 92: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  /lib/svc/method/wsvws: line 103: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  skipping      54 lines of /var/log/jboss-apps/wsvws/server.log

                  [OK]

                  [ Jul 15 12:02:52 Method "start" exited with status 0 ]

                  [ Jul 15 12:02:52 Stopping because all processes in service exited. ]

                  [ Jul 15 12:02:52 Executing stop method ("/lib/svc/method/wsvws stop") ]

                  Stopping jboss-as... Jboss is stopped.

                  [ Jul 15 12:02:52 Method "stop" exited with status 0 ]

                  [ Jul 15 12:02:52 Executing start method ("/lib/svc/method/wsvws start") ]

                  Starting jboss-as ... cleaning the cache ...

                  /opt/jboss-apps/wsvws/tmp not exist

                  /opt/jboss-apps/wsvws/data not exist

                  /lib/svc/method/wsvws: line 92: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  /lib/svc/method/wsvws: line 103: /var/log/jboss-apps/wsvws/console.log: Permission denied

                  skipping      54 lines of /var/log/jboss-apps/wsvws/server.log

                  [OK]

                  [ Jul 15 12:02:54 Method "start" exited with status 0 ]

                  [ Jul 15 12:02:54 Stopping because all processes in service exited. ]

                  [ Jul 15 12:02:54 Executing stop method ("/lib/svc/method/wsvws stop") ]

                  Stopping jboss-as... Jboss is stopped.

                  [ Jul 15 12:02:54 Method "stop" exited with status 0 ]

                  [ Jul 15 12:02:54 Restarting too quickly, changing state to maintenance ]

                   

                  [/code]

                   

                  One can see the Jboss is started and then stopped many times and at last it was changed to the maintenance mode.

                   

                  Besides, I have no any problem by starting or stopping the Jboss manually by using the init-script '/lib/svc/method/wsvws'. This can be confirmed in the log by many 'exited with status 0'.

                   

                  Now I got

                   

                  root@S001AP61-TEST (vws-tst1) # svcs -xv wsvws

                  svc:/application/jboss/wsvws:default (wsvws service)

                  State: maintenance since Mon Jul 15 12:02:54 2013

                  Reason: Restarting too quickly.

                    See: http://sun.com/msg/SMF-8000-L5

                    See: /var/svc/log/application-jboss-wsvws:default.log

                  Impact: This service is not running.

                  • 6. Re: Can not start/enable the service
                    user10501597

                    I've added the 'exit $SMF_EXIT_OK' in my Jboss init-script as follow:

                     

                    [code]

                    ...

                    case "$1" in

                      start)

                          start

                       exit $SMF_EXIT_OK

                          ;;

                      stop)

                          stop

                       exit $SMF_EXIT_OK

                          ;;

                      restart)

                          $0 stop

                          $0 start

                          ;;

                      status)

                          status

                          ;;

                      cleanup)

                          cleanup

                          ;;

                      *)

                          ## If no parameters are given, print which are avaiable.

                          echo "Usage: $0 {start|stop|status|restart|reload|cleanup}"

                          exit 1

                          ;;

                    esac

                    [/code]

                     

                    But I got the same result as before.

                    • 7. Re: Can not start/enable the service
                      Pascal Kreyer -Oracle

                      Check with jboss community why you have those errors :

                       

                      Starting jboss-as ... cleaning the cache ...

                      /opt/jboss-apps/wsvws/tmp is deleted

                      /opt/jboss-apps/wsvws/data is deleted

                      /lib/svc/method/wsvws: line 92: /var/log/jboss-apps/wsvws/console.log: Permission denied

                      /lib/svc/method/wsvws: line 103: /var/log/jboss-apps/wsvws/console.log: Permission denied

                      skipping      54 lines of /var/log/jboss-apps/wsvws/server.log

                       

                      Maybe should jboss started with a specific account.

                      • 8. Re: Can not start/enable the service
                        user10501597

                        I notice int the log file there are some 'su: Sorry'

                         

                        [code]

                        ...

                        [ Jul 15 14:50:55 Method "start" exited with status 0 ]

                        su: Sorry

                        [ Jul 15 14:50:57 Stopping because all processes in service exited. ]

                        [ Jul 15 14:50:57 Executing stop method ("/lib/svc/method/wsvws stop") ]

                        Stopping jboss-as... Jboss is stopped.

                        [ Jul 15 14:50:57 Method "stop" exited with status 0 ]

                        [ Jul 15 14:50:57 Executing start method ("/lib/svc/method/wsvws start") ]

                        Starting jboss-as ... cleaning the cache ...

                        /opt/jboss-apps/wsvws/tmp not exist

                        /opt/jboss-apps/wsvws/data not exist

                        skipping       55 lines of /var/log/jboss-apps/wsvws/server.log

                        [OK]

                        [ Jul 15 14:50:59 Method "start" exited with status 0 ]

                        su: Sorry

                        [ Jul 15 14:51:01 Stopping because all processes in service exited. ]

                        [ Jul 15 14:51:01 Executing stop method ("/lib/svc/method/wsvws stop") ]

                        Stopping jboss-as... Jboss is stopped.

                        [ Jul 15 14:51:01 Method "stop" exited with status 0 ]

                        [ Jul 15 14:51:01 Executing start method ("/lib/svc/method/wsvws start") ]

                        Starting jboss-as ... cleaning the cache ...

                        /opt/jboss-apps/wsvws/tmp not exist

                        /opt/jboss-apps/wsvws/data not exist

                        skipping       55 lines of /var/log/jboss-apps/wsvws/server.log

                        [OK]

                        [ Jul 15 14:51:03 Method "start" exited with status 0 ]

                        su: Sorry

                        [ Jul 15 14:51:05 Stopping because all processes in service exited. ]

                        [ Jul 15 14:51:05 Executing stop method ("/lib/svc/method/wsvws stop") ]

                        Stopping jboss-as... Jboss is stopped.

                        [ Jul 15 14:51:05 Method "stop" exited with status 0 ]

                        [ Jul 15 14:51:05 Executing start method ("/lib/svc/method/wsvws start") ]

                        Starting jboss-as ... cleaning the cache ...

                        /opt/jboss-apps/wsvws/tmp not exist

                        /opt/jboss-apps/wsvws/data not exist

                        skipping       55 lines of /var/log/jboss-apps/wsvws/server.log

                        [OK]

                        [ Jul 15 14:51:07 Method "start" exited with status 0 ]

                        su: Sorry

                        [ Jul 15 14:51:09 Stopping because all processes in service exited. ]

                        [ Jul 15 14:51:09 Executing stop method ("/lib/svc/method/wsvws stop") ]

                        Stopping jboss-as... Jboss is stopped.

                        [ Jul 15 14:51:09 Method "stop" exited with status 0 ]

                        [ Jul 15 14:51:09 Restarting too quickly, changing state to maintenance ]

                         

                        ...

                        [/code]

                         

                        But when I start or stop the Jboss manually with this init-script, there is no problem.

                         

                        One can see at the very beginning of the script it uses /bin/bash. Maybe the SMF uses other shell?

                        • 9. Re: Can not start/enable the service
                          984266

                          your init scripts need to own by root:root, or root:sys

                           

                          I prefer to keep it root:root

                          • 10. Re: Can not start/enable the service
                            user10501597

                            I've tried both. But this doesn't help.

                            • 11. Re: Can not start/enable the service
                              984266

                              is script file have su command?

                              • 12. Re: Can not start/enable the service
                                user10501597

                                Yes. See above the whole init-script (/lib/svc/method/wsvws).

                                • 13. Re: Can not start/enable the service
                                  984266

                                  I a bit confuse now,

                                   

                                  you says you run the script manually, it works. I would like to know, you run as root or  wsvws?

                                   

                                  if you run as wsvws, of course it fail, as you need to input password while su.

                                   

                                  if you run as root, then you have to change your xml file as follow:

                                    <method_context>

                                    <method_credential user='root' group='root' />

                                    </method_context>


                                  hopes my assumption is correct.

                                  • 14. Re: Can not start/enable the service
                                    user10501597

                                    Hi,

                                     

                                     

                                    The init-script should be run from everyone. I've added the following line in the "/usr/local/etc/sudoers":

                                    [code]

                                    ...

                                    wsvws ALL=/lib/svc/method/wsvws start, /lib/svc/method/wsvws stop, NOPASSWD: ALL

                                    ...

                                    [/code]

                                     

                                     

                                     

                                    This means everyone can run this init-script without giving password, right?

                                     

                                     

                                     

                                    Now I find an interessting thing:

                                    1.

                                    If I run the init-script /lib/svc/method/wsvws as 'root', there is no any problem.

                                     

                                     

                                     

                                    2.

                                    If I login as user 'wsvws' (su wsvws) and run the init-script '/lib/svc/method/wsvws start', I got really the same error message 'su: Sorry'.

                                     

                                     

                                     

                                    But if I run the script with 'sudo' at the beginning 'sudo /lib/svc/method/wsvws start', then there is no problem.

                                     

                                     

                                     

                                    So I change the manifest and add the 'sudo' as follow:

                                     

                                     

                                    [code]

                                    ...

                                    <exec_method type='method' name='start' exec='sudo /lib/svc/method/wsvws start'

                                    timeout_seconds='60' />

                                    <exec_method type='method' name='stop' exec='sudo /lib/svc/method/wsvws stop'

                                    timeout_seconds='60' />

                                    <exec_method type='method' name='restart'

                                    exec='sudo /lib/svc/method/wsvws restart' timeout_seconds='60' />

                                    ...

                                    [/code]

                                     

                                    But when I run the SMF I got another error: /sbin/sh: sudo: not found

                                     

                                    Here one can see, the SMF will just use the /sbin/sh.

                                    1 2 Previous Next