{"id":223,"date":"2008-09-26T09:29:06","date_gmt":"2008-09-26T01:29:06","guid":{"rendered":"http:\/\/ramfree17.net\/capsule\/?p=223"},"modified":"2008-09-26T09:29:06","modified_gmt":"2008-09-26T01:29:06","slug":"running-rtc-as-a-windows-service","status":"publish","type":"post","link":"https:\/\/ramfree17.net\/capsule\/?p=223","title":{"rendered":"Running RTC as a Windows service"},"content":{"rendered":"<p>I need to run the Rational Team Concert Jazz Build Engine as a Windows service as we need it to run non-stop as part of the continuous integration service. The catches though are <\/p>\n<ul>\n<li>it (theoretically) wouldn&#8217;t stop as it keeps on waiting for build requests from the RTC server. This makes it as an unlikely candidate for scheduled tasks unless I will cookup a script for terminating it before the actual run. Messy if I still have to check if there is a build in progress.<\/li>\n<li>the machine hosting it is not a dedicated machine so a couple of admins usually login to do some stuff which kills any running processes executed by the currently logged-in user.<\/li>\n<\/ul>\n<p>Windows provides the sc.exe utility for creating and removing Windows services but it only accepts executables and not scripts. I have to set some environment properties and parameters so this is out of the running. The <a href=\"http:\/\/wrapper.tanukisoftware.org\">Java Service Wrapper<\/a> is a good alternative but I misread the instructions so ended up using the AutoExnt utility in the <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&#038;displaylang=en\">Win2003 Resourse Kit<\/a>.  The files are still usable in Windows XP.<\/p>\n<p>Only three files are needed from the kit namely Autoexnt.exe, instexnt.exe and servmess.dll. These files are to be dropped in the <strong>%SYSTEMROOT%\\system32<\/strong> directory.. The next step is to create the <strong>%SYSTEMROOT%\\system32\\autoexnt.bat<\/strong> (the file needs to be named like that) with the commands to be executed. My script looked something like this:<\/p>\n<p><code><br \/>\n@echo off<br \/>\nsetlocal<br \/>\nREM<br \/>\nREM Workstation specific settings.<br \/>\nREM<br \/>\nset JBE_Eclipse_Dir=C:\\Apps\\IBM\\jazz\\buildsystem\\buildengine\\eclipse<br \/>\nset JBE_Repository_URL=https:\/\/<server .url.here>\/jazz<br \/>\nset JBE_EngineID=ToolingBuilder<br \/>\nset JBE_user=kerberos<br \/>\nset JBE_password=<replace With Password><\/p>\n<p>REM<br \/>\nREM If proxy is not needed, switch the JBE_VMArgs_OPTS to use the empty one<br \/>\nREM<br \/>\nset proxyHost=<\/replace><replace -with-company-proxy><br \/>\nset proxyPort=3128<\/p>\n<p>set JBE_VMArgs_OPTS=-vmargs  -DhttpsproxyHost=%proxyHost% -Dhttps.proxyPort=%proxyPort%<br \/>\nREM set JBE_VMArgs_OPTS=<\/p>\n<p>REM<br \/>\nREM Set the JVM to use to the IBM J9 VM otherwise the compilation will fail.<br \/>\nREM<br \/>\nset java_home=C:\\Apps\\IBM\\SDP70\\jdk<br \/>\nset classpath=.;%java_home%\\lib<br \/>\nset path=%java_home%\\bin;%path%<\/p>\n<p>REM<br \/>\nREM Invoke the Jazz Build Engine client.<br \/>\nREM<br \/>\npushd %JBE_Eclipse_Dir%<br \/>\njbe.exe -repository %JBE_Repository_URL% -userId %JBE_user -pass %JBE_password% -engineId %JBE_EngineID% -sleeptime 1 %JBE_VMArgs_OPTS%<\/p>\n<p>endlocal<\/p>\n<p><\/replace><\/server><\/code><\/p>\n<p>The next step is invoking the command <strong>instexnt install<\/strong> to install the service. The only final thing to do is to go inside the Services console of Windows and reconfigure the AutoExNT service to start automatically at boot up. Of course, it needs to be started as well if you want to use the service immediately. \ud83d\ude42<\/p>\n<p>There are a few more help in the Windos 2003 Resource Kit help but the only thing of interest is using <strong>instexnt install \/interactive<\/strong> to install the service. This will cause the service to pop out a command window wherein the user can view the console output. The downside is that the user can close the window which will terminate the service.<\/p>\n<p>I have thought about migrating the system to use the Java Service Wrapper but using the AutoExNT separates the service component which allows JBE implementors to replace\/delete the JBE installation directory without going through the setup process again.<\/p>\n<p>[edit 20081002] Dom Weinand posted <a href=\"https:\/\/jazz.net\/wiki\/bin\/view\/Main\/JbeAsAWindowsService\">this link<\/a> in the RTC <a href=\"https:\/\/jazz.net\/forums\/viewtopic.php?t=2340\">user forum<\/a> on how to use the Java Service Launcher to run JBE as a Windows service[\/edit]<\/p>\n<p>ciao!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I need to run the Rational Team Concert Jazz Build Engine as a Windows service as we need it to run non-stop as part of the continuous integration service. The catches though are it (theoretically) wouldn&#8217;t stop as it keeps on waiting for build requests from the RTC server. This makes it as an unlikely [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-laboratory"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223"}],"version-history":[{"count":0,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=\/wp\/v2\/posts\/223\/revisions"}],"wp:attachment":[{"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramfree17.net\/capsule\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}