3 Replies Latest reply on Oct 1, 2010 11:00 AM by Peter Johnson

    Explanation of commands in service.bat

    Anne Forumer Newbie

      I am trying to understand service.bat script. In the following snippet:

       

      echo Y > .r.lock
      jbosssvc.exe -p 1 "Starting %SVCDISP%" > run.log
      call run.bat -b 0.0.0.0 -c all < .r.lock >> run.log 2>&1
      jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run.log
      del .r.lock
      goto cmdEnd

      What does "-p" option mean? It is not explained in the command's help.

      What does it mean to take input from the lock file " < .r.lock" ?

      What's the purpose of the second "jbosssvc.exe -p 1?  Shutdown ... !

       

      Thank You!

        • 1. Re: Explanation of commands in service.bat
          Peter Johnson Master

          I don't know exactly what the -p does (perhaps it means 'print' and the digit that follows, 1, references stdout), but I suspect it tells jbossvc.exe to not create a service, and instead to just echo the text, and possibly other info, to the run.log.

           

          Taking input from the lock file causes the file to be locked. This prevents the app server from being started twice (the second attempt to run it would pause waiting for the file to become available).

           

          If you are attempting to run two JBoss AS services, then you need to rename a lot of things in the file to prevent collisions (the r.lock file being just one of them). I have reworked the service.bat file to place all such information at the top of the file where it is easy to change (and have the change reflected throughout the file). I can post a link if you like.

          • 2. Re: Explanation of commands in service.bat
            Anne Forumer Newbie

            At what point does the file become unlocked? After JBoss is stopped and is that when the second "Jbosssvc.exe -p 1 ..." is run after which lock file is deleted?

             

            Please post the "link" you mentioned.

             

            Thank You!

            • 3. Re: Explanation of commands in service.bat
              Peter Johnson Master

              The r.lock file is locked as long as run.bat is active. Once run.bat exits, the lock is released. Note that this happens before the second jbossvc.exe run.

               

              The link: get the source code for JBoss in Action (http://www.manning.com/jamae) from http://code.google.com/p/jbia/ . In ch15, target 04 generates two services. The source for the service.bat file is at ch15/src/service/windows.