I am trying to stop a windows service that is using a port I need, but the service keeps restarting it self. How do I stop it from restarting itself?
I followed this question to kill it (How to kill the process currently using a port on localhost in windows?), but when I listen for the port again a new service started already:
How this happened and some notes:
I created a Nodejs service and started it as a windows service (so now it is running in it's own windows instance)
My service had a cmd line to stop it self net stop "Service Name". This semi-failed for some reason (it did stop, kinda, but then it starts again)
I have even uninstalled the Nodejs service completely, but still something is starting it up over and over (because the port stays in use)
I can't move the Nodejs service files, because they are in use
To find out what application/service the PID is referring to, you can open Resource Monitor by running: resmon
Then choose CPU tab and look for the PID, Note: it could be under Processes or Services. If it's a service then you can stop and disable it so it won't run again.
If it's a Process, the name should give you an idea what it is.
Related
I am running a game server as a service using systemctl to start and stop a script that runs the whole thing. I tried to modify the script to let me use a screen so I could attach to the process that the server is being run on, and issue commands. But so far I've not had much luck. Is it possible to attach to services that are running on a server?
This question belongs on the Unix/Linux StackExchange.
See e.g:
https://unix.stackexchange.com/questions/453998/systemd-connect-to-stdin-stdout-after-service-has-started
If you want to solve it via programming, you could consider writing a small web application as the interface instead of the console.
Not in systemd, but you can start the service using
screen -D -m yourservice
which will create a detached screen session that will wait for the process to exit (so systemd does not see the service terminating immediately if you use this in an ExecStart line). You can then attach to that session normally.
I have a Google VM, and i can start a web server. The command i issue is: python server.py.
My plan is to have the application running.
Since i will eventually close my pc (and thus the terminal), will the application continue running normally?
Or, do i have to start the server and then use disown, to make the app run in the background?
NOTE: If the second option is the case, does this mean that when i re-log in, and i want to shut down the server, the only way to do it is with pkill?
I absolutely 100% new to VPS and linux as of yesterday, and I'm running into an issue. Here's the process:
I SSH into my VPS box in OSX terminal. The VPS is running CentOS 6 for what it's worth.
I navigate to the correct folder and I run node app.js to launch my app in NodeJS/ExpressJS.
App launches and is readily accessible via the web at my VPS' ip address + the allocated port number.
If I put my laptop to sleep, the app crashes and is no longer accessible via web.
Again, being new to Linux I'm not sure how to solve this problem. It makes sense, as the terminal that was running/taking logs of the node app is no longer responding, but what I'd like is:
a) To be able to start up the app remotely then have it just...run...forever, until I manually stop it
b) To be able to SSH back into my server intermittently to check the logs, either via my mobile phone or my laptop.
Are either of these two things possible? Clearly my protocol of launching the app via terminal (as I'd normally do if running it locally) isn't the correct way to do it but I'm having trouble finding resources telling me what to do!
EDIT: I'm actually using Node Supervisor to run the app which helps keep it up and running when things crash, not sure if that affects the situation.
Most probably your app is printing to standard out (the console), and that stream is closed/broken, when you put your laptop to sleep.
There are at least two options:
Use screen: Just type screen before starting your app. Then start your app. Then Ctrl-A-D to detach from the screen. You can then safely log out from the VPS and put your laptop to sleep. To go back to the output of your app, log back in and type screen -r
Run the app in the background: node app.js &.
I have an Azure worker that works fine locally but crashes on live fabric. I want to hook up a remote debugger, but I can't because the program crashes before I can RDP in and attach a debugger.
Is there a way to manually restart WaWorkerHost.exe without restarting the system?
You can kill WaWorkerHost, it will be restarted automatically by WaHostBootstrapper (just give it a minute).
Responding to your comment:
If I understand you correctly you should
first deploy an empty worker (or one that does not crash)
connect to your role instance (remote desktop)
then deploy with the binaries you want to test.
A blog series on connecting debugger under azure (Putting here for other peoples reference I guess you have got this far)
http://blogs.u2u.be/peter/post/2011/06/21/Remote-debugging-an-Azure-Worker-role-using-Azure-Connect-Remote-desktop-and-the-remote-debugger.aspx
Now to the problem at hand what I would surgest doing is getting your worker to suspend it self in the startup code until the debugger is attached and logging.
So you can just use the following property and method. I would sleep the thred as well while waiting.
while (!(System.Diagnostics.Debugger.IsAttached && System.Diagnostics.Debugger.IsLogging()))
{
System.Threading.Thread.Sleep(1000);
}
How do I get my Azure Web Role to always use the same port when I run the solution instead of always incrementing the port by one?
I assume you're talking about running locally in the WA Simulation Environment. If so, it tries to use the port you specified (usually 80) and increments the port number by one at a time until it finds a free port.
If the port keeps increasing every time you run, it means the port is not getting freed up when you shut down your app. First, make sure you're actually stopping the previous run (open up the "dev fabric" or "compute emulator" depending on which SDK version you're using, and be sure to stop the old run). Second, you should be able to reclaim all those old ports for good if you shut down the dev fabric (compute emulator). You can do that by right-clicking the system tray icon and shutting down, or do "csrun /devfabric:shutdown" from the command line.