I installed multiple instances of Tomcat in my Ubuntu machine. I was trying to start Tomcat (one of the instances from multiple Tomcat instances) from Jenkins. Jenkins is showing that Tomcat started. But Tomcat is still in shutdown state only.
In jenkins, When an build completes all the process Id's which are involved in the build are getting killed.
So mentioning BUILD_ID=dontKillMe ./home/tomcat/startup.sh in Execute shell script make it possible.
Related
I have installed Jenkins as standalone in a server. But due to security policy of the company, server(wherever Jenkins is running) will be shutting down or restarting automatically after 24 hours. So Jenkins instance which is running in command line inside the server is also closing.
So Jenkins is becoming down
Creating a task scheduler to run Jenkins through command line is not helping since i'm running test automation scripts where the chrome browser is not opening if i schedule a task.
Jenkins is executing internally, Console is running for Web services. What it is executing on Web browser is not showing, as it didn't launch browser.
We have a 3 am restart script for tomcat service some of days it restarts properly and some day's it does not
(but once i check java process for tomcat it will be running without any errors)
I'm trying to run a function that we have to recycle our tomcat instance when doing a deploy to tomcat via bamboo. I thought that we would be able to use bamboo's ssh task to call our function tomcat recycle. I am able to run the function ssh connected to the box via putty but in bamboo we get the message:
ksh: tomcat: not found
Does anybody have any experience restarting tomcat automatically via bamboo? Is there a better way?
To restart tomcat via Bamboo
Create a ssh task -
You should be having tomcat service file in /etc/init.d (if you are using redhat)
/etc/init.d/tomcat start
/etc/init.d/tomcat stop
/etc/init.d/tomcat restart
should work
I installed the Apache Tomcat/7.0.65 on my Mac, then, run the startup.sh. It works great fine and the service is available immediately. But when I run the shutdown.sh to stop the service. It seems that the shell scripts can not aware of the tomcat running. Would someone please help me with this problem?
I had a similar problem. In my case, although running <Tomcat Root>/bin>./shutdown.sh was technically working (the tomcat process was being killed), the tomcat service was restarting automatically (after a few seconds).
If you run <Tomcat Root>/bin/catalina.sh stop or <Tomcat Root>/bin/shutdown.sh and you see that after a few seconds tomcat restarts => that basically means that you are not able to shutdown tomcat for good. Thus, if you want to make sure that tomcat does not restart automatically, run brew services stop tomcat.
OBS: If you want to find what is your <Tomcat Root> run brew ls tomcat
at the moment jenkins build my project and at the end the artifact is deployed on a remote tomcat via jenkins deploy plugin.
the problem is that after several redeployments this process fails (sometimes tomcat hangs or (un)deployment fails). in all cases stopping tomcat and manually undeploying helps.
Is there a way to stop tomcat before building/deploying, delete the old war and appfolder, and restart tomcat before deploy plugin wants to deploy the artifact?
thx in advance
You could write a batch file that does all the things mentioned:
stop tomcat
delete war files
start tomcat again
Then you can add a new pre/post build task in job configuration as execute batch and simply point it to run your batch file.
Added:
You can use PsExec - http://technet.microsoft.com/en-us/sysinternals/bb897553 It allows you to run processes remotely. Put batch on remote machine and from local one using Jenkins run sth like this: PsExec.exe \xx.xx.x.x C:\MyScript.bat
one addition to accepted answer:
it is important to reroute the output and error output of PsExec call (took me 2 days of debugging). See http://jenkins.361315.n4.nabble.com/remotely-executing-commands-td3476417.html
it seems that if called from java (like jenkins/tomcat) or .net PsExec hangs or quits with error. so the call should look like:
c:\someBatchWithPsExec.bat >>log.txt>&1
or explicitly on every call:
PsExec.exe -u [domain\remoteuser] -p [password] /accepteula \remoteMachine net [stop|start] Tomcat7 >>log.txt>&1
i guess if jenkins runs with domain\user u don't have to mention it in command?! (just tried it but it didn't work - the net commands fail)