Run Apache 2.2 as a single httpd.exe for debugging - windows

I'm running Apache 2.2 in console mode on Windows to test an apache module I'm writing.
By default, a parent httpd.exe is started (with one thread), which starts a child httpd.exe with a number of worker threads.
Now I have to attach the debugger to the child process each time to be able to debug my module.
Is there a way to configure Apache to run from a single httpd.exe? (Like good old days if I remember correctly) I've been searching the docs, but don't find anything else than limitations of the number of requests handles per thread or process...

You might want to use httpd.exe -X which will run apache as a single process without giving back terminal/cmd prompt control.

Related

How can I see all the processes that were run during a specific time period

I know that PS will show me all the currently running processes. But that won't show me anything that's started, then stopped, during some time span. Is there any other way that I can see all the processes that were run during some event?
I'm trying to setup a way of auditing all the processes that ran during a build compilation. I can use PS to check all the running processes at the start of the build, and even run it again at the end. And I can setup a separate thread that will run PS over and over and over again during the build to catch all the processes that might have been run in the middle. But is there some better way of accomplishing this task that I'm not aware of?
This build is being run on a mac, so it uses the mac version of bash.
After your processes have run you can go to the Console (in the Applications/Utilities Folder) and check the system logs for the time period of interest. Many messages are written so the narrower the time window the better.

Appcelerator studio won't start (on loading screen)

After updating Appcelerator Studio it won't load. Starting it produces starting screen showing "loading studio" 4ever. It is just stuck there. Any idea on what might have caused this?
Thanks.enter image description here
I had this problem too (on a Mac). You can try this:
download and install the latest Appcelerator version
logout of Appcelerator using CLI or terminal window (if you can open it of course), using "appc logout -D".
Start Appcelerator again and login again. This works for me.
‘jstack’ is an effective command line tool to capture thread dumps. jstack tool is shipped in JDK_HOMEbin folder. Here is the command that you need to issue to capture thread dump:
jstack -l <pid> <file-path>
where
pid: is the Process Id of the application, whose thread dump should be captured
file-path: is the file path where thread dump will be written in to.
go for-:
Example:
jstack -l 37320 > /opt/tmp/threadDump.txt
Library/java/javaVertualMachines/jdk1.8.0_151.jdk/content/home/bin/jvisualvm
refer to this link for better understand
https://dzone.com/articles/how-to-take-thread-dumps-7-options
Launch the jvisualvm. On the left panel, you will notice all the java applications that are running on your machine. You need to select your application from the list (see the red color highlight in the below diagram). This tool also has the capability to capture thread dumps from the java processes that are running in remote host as well.
Now go to the “Threads” tab. Click on the “Thread Dump” button as shown in the below image. Now Thread dumps would be generated.
Java Mission Control (JMC) is a tool that collects and analyze data from Java applications running locally or deployed in production environments. This tool has been packaged into JDK since Oracle JDK 7 Update 40. This tool also provides an option to take thread dumps from the JVM. JMC tool is present in Library/java/javaVertualMachines/jdk1.8.0_151.jdk/content/home/bin/jmc.exe
Once you launch the tool, you will see all the Java processes that are running on your local host. Note: JMC also has the ability to connect with java processes running on a remote host. Now on the left panel click on the “Flight Recorder” option that is listed below the Java process for which you want to take thread dumps.
Here in the “Thread Dump” field, you can select the interval in which you want to capture thread dump. As per the above example, every 60 seconds thread dump will be captured. After the selection is complete start the Flight recorder.
Finally appc logout
and Login.

How can I run an alert program when a Windows Service fails to start?

I have a Windows service whose start-up is set to 'Automatic', so it starts whenever the system boots up.
But this jobs sometimes did not start due to unknown reasons. I want to setup an alert program (.bat) to run whenever the service fails to start.
I tried using Recovery Mode options in service property, but it is not working. I think it is for jobs crashing with errors.
You can create a script that lists the service of yours and see whether it is running (using the sc command). Then you might to put that script to Startup menu. Should the script run before the service is started, you would need to schedule the script to be running periodically (to give the service some time to be started) using either of schtasks, at, or back in the nt4 days there was (still functional I presume) nice gui version of at in nt 4 resource kit called winat, if you have access to it.

SonarQube server won't start

I've been using SonarQube for a year now and once I had been through all the installation process, I never got any problem... Until now.
I'm just trying to analyze a Maven Project (like I did several times before). To do so, I need to run the server first (port 9000). But when I launch "StartSonar.bat" (I'm on Windows), I get a huge log and finally the wrapper stops.
I think there is something wrong with the port 9000 although I'm not sure because I'm not that advanced with analysing logs and everything.
Here's a link to download the log I get
Thanks for your help!
The log states "Address already in use: bind" which means that some other tool already runs on that port. Choose another one should already do the trick.
Or there is a zombie-process still running (no clean shutdown). But you should see a process in the task manager - just kill that one. Usually a reboot should solve that too.
Run netstat -abo on the Windows command line to see which ports are used, by which programs they are used and their process IDs (PID). With the PID you can find the process in Task Manager and kill it there if necessary.

How can my bash script detect that tomcat is fully stopped? [duplicate]

This question already has answers here:
shell script to kill tomcat service if it is not stopped by stop command after certain amount of time?
(2 answers)
Closed 6 years ago.
I have tomcat downloaded on my computer (not installed as a service).
I am writing a script that upgrades a webapp running on the tomcat server. The script roughly works like this:
Stop tomcat
Perform several upgrade operations
Start tomcat
When performing the upgrade operations, I need to know that tomcat is fully stopped. However if I run $TOMCAT_HOME/bin/catalina.sh stop then that script exits before tomcat is actually stopped and if I execute the upgrade operations while tomcat is still running that might cause things to crash. In addition, the upgrade operations may finish quickly and this can cause the tomcat startup to execute before the shutdown is complete which causes tomcat to crash.
Right now my solution is to wait for 5 seconds after the shutdown is initiated but I am wondering if there is a more elegant solution to the problem.
One way to verify whether the process is still running is by using its process id. Depending on your installation, you should be able to find the process id of your tomcat server in:
/opt/tomcat/catalina.pid
In theory, if this file is empty, then the process should have ended although depending on the implementation and certain circumstances (tomcat crashing?) this might not be true. To be safe, you can take the pid found in this file and just check whether this process is still running.
ps -p <pid>
The above command will return the pid, the time and the command of the process if it is still active.
Another option would be to check if a certain port (the one that Tomcat uses) can be bound. If you can't bind on this port, it means that Tomcat is still running.
Anyway, Felix's solution is more appropriate and it's probably better to use it. I only wrote my suggestion in order to provide more alternatives, also not all Tomcat installations have catalina.pid (at least the default one doesn't).

Resources