5 Replies Latest reply on Feb 7, 2002 7:22 AM by Adrian Brock

    Restart jboss from the cron

    Idoia Newbie

      I would like to restart JBoss dayly, specifying it in a cron. The scripts works fine from the command line but not in the cron.
      Any idea???

        • 1. Re: Restart jboss from the cron
          Adrian Brock Master

          What error message do you see?
          Does cron have your jre in its path?

          Regards,
          Adrian

          • 2. Re: Restart jboss from the cron
            Idoia Newbie

            Simply it is not executed. No errors displaye.
            This is the script. If iexecute it in the command line, no problen, but if I introduce it in the cron of the same user it is not executed

            #!/bin/sh

            #Mover el fichero de log
            DATE=`/usr/bin/date +%d%m%y-%H:%M`
            RAIZ=/internet/JBoss/JBoss-2.4.3/log/arranque
            /usr/bin/cp $RAIZ.log $RAIZ.$DATE

            # Minimal jar file to get JBoss started.

            #JBOSS_CLASSPATH=$JBOSS_CLASSPATH:/internet/JBoss/JBoss-2.4.3/bin/run.jar
            JBOSS_CLASSPATH=/internet/JBoss/JBoss-2.4.3/bin/run.jar

            # Add all login modules for JAAS-based security
            # and all libraries that are used by them here
            #JBOSS_CLASSPATH=$JBOSS_CLASSPATH

            # Check for SUN(tm) JVM w/ HotSpot support
            #
            HOTSPOT=`java -version 2>&1 | grep HotSpot`"x"
            if [ "$HOTSPOT" != "x" ]; then
            HOTSPOT="-server"
            else
            HOTSPOT=""
            fi

            # Add the XML parser jars and set the JAXP factory names
            # Crimson parser JAXP setup(default)
            #JBOSS_CLASSPATH=$JBOSS_CLASSPATH:../lib/crimson.jar
            JBOSS_CLASSPATH=$JBOSS_CLASSPATH:/internet/JBoss/JBoss-2.4.3/lib/crimson.jar
            JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.Document
            BuilderFactoryImpl
            JAXP="$JAXP -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXPars
            erFactoryImpl"

            cmd="/usr/j2re1_3_1_02/bin/java $HOTSPOT -Xrs $JAXP -classpath $JBOSS_CLASSPATH
            org.jboss.Main $@"
            ${cmd} > /internet/JBoss/JBoss-2.4.3/log/arranque.log 2>&1 &
            echo $! > /internet/JBoss/JBoss-2.4.3/log/jboss.pid
            sleep 10
            exit 1

            • 3. Re: Restart jboss from the cron
              Adrian Brock Master

              I can't see anything obvious.
              It doesn't work isn't very much information :-(

              Does the jboss.pid file get created?

              Have you tried adding debug statements, e.g.

              echo GOTHERE >> ~/jbosscron.debug

              Regards,
              Adran

              • 4. Re: Restart jboss from the cron
                Idoia Newbie

                I think that the script is not executed.
                There are no messages

                • 5. Re: Restart jboss from the cron
                  Adrian Brock Master

                  You don't say which flavour of Un*x you are running.

                  Here's a couple of links for cron configuration,
                  (found using www.google.com with search "cron user")

                  http://www.uwsg.iu.edu/usail/automation/cron.html
                  http://www.redhat.com/support/resources/tips/cron/cron.html

                  Regards,
                  Adrian