I need to detect when a program crashes or is not running using python and restart it. I need a method that doesn't necessarily rely on the python module being the parent process.
I'm considering implementing a while loop that essentially does
ps -ef | grep process name
and when the process isn't found it starts another. Perhaps thi...
Hi, assuming that I know the PID of a process and want to do a search in ps -A, how do I do it? I tried doing this:
echo "Enter PID to search: "
read PID
search=$(ps -A | grep -v PID | awk '{print $1}')
This returns me with a long list of PIDs. So how can I get use each individual value of the output and do:
if [ "$PID" = "*each_val...
What is the PID assignment policy in Windows? Repeated runs of a process calling _getpid() indicates non sequential assignment (3548,3344,3628,2748,4872,2360).
Given the observed non sequential assignment of PIDs, is it possible for two different process with the same pid to be executed closely in time from one another? Obviously the ...
Any way to do this?
I have a script that exports a few vars and runs a component.
I'm looking to find out the actual values of some of these vars while the process is running. (Which applies here, because I'll be incorporating those values into another script/program)
The vars themselves are PID specific (I'm quite new at this, if tha...
Hi,
I need to identify the P(rocess) ID of an executing batch file from a PowerShell (v1.0) script. Can anyone suggest a way of doing this?
Thanks, MagicAndi.
...
I am trying to use port 80 for my application server, but when I perform "netstat -aon" I get
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
When I look up the process in task manager, it shows PID 4 is SYSTEM, thats it, not extension... nothing, just "SYSTEM". Whats going on here?
I'm afraid to end this process, what do I do?
UPDATE:
I've ...
I'm writing a Python script that may or may not (depending on a bunch of things) run for a long time, and I'd like to make sure that multiple instances (started via cron) don't step on each others toes. The logical way to do this seems to be a PID-based lockfile… But I don't want to re-invent the wheel if there is already code to do this...
I'm using C# .NET 2.0. I need to determine if a PID exists. I came up with the following code:
private bool ProcessExists(int iProcessID)
{
foreach (Process p in Process.GetProcesses())
{
if (p.Id == iProcessID)
{
return true;
}
}
return false;
}
Is there a better way to do this ot...
I'm kinda new to Java, so haven't yet fully grasped the concept of multithreading.I would like to create a PIDController class that allows me to do this:
ControllerMethods methods = new ControllerMethods()
{
public long getError(long setpoint)
{
...
Hi,
I am trying to implement a simple log server in Bash. It should take a file as a parameter and serve it on a port with netcat.
( tail -f $1 & ) | nc -l -p 9977
But the problem is that when the netcat terminates, tail is left behind running. (Clarification: If I don't fork the tail process it will continue to run forever even the ...
I'm trying to re-launch a WCF service that I killed earlier, but I'm getting an AddressAlreadyInUseException. The port it's attempting to use is 1819.
I ran netstat -nao from the command line, and have found there is a listening process on port 1819, that has a PID of 4840. I went into Process Explorer (from SysInternals) to try to ki...
What is the simplest/best way to ensure only 1 copy of given script is running - assuming it's bash on linux?
At the moment I'm doing:
ps -C script.name.sh > /dev/null 2>&1 || ./script.name.sh
but it has several issues:
it puts the check outside of script
it doesn't let me run the same script from separate accounts - which I would ...
Hello Guys
Is there any possibility that I can directly send signal to a Java virtual machine which is created by calling JVM_CreateJavavm in native C/C++ code?
e.g.:
For a normal Java process, say its pid is 12345, I can send a signal 3 to it like this ...
kill -3 12345, and hopefully I could trigger javacore or heapdump by changing...
Is there a way to do this purely in a .bat file?
The purpose is to launch iexplore, then kill just that instance when it's finished..
...
i am using the program synergy together with an ssh tunnel
it works, i just have to open an console an type these two commands:
ssh -f -N -L localhost:12345:otherHost:12345 otherUser@OtherHost
synergyc localhost
because im lazy i made an Bash-Script which is run with one mouseclick on an icon:
#!/bin/bash
ssh -f -N -L localhost:123...
On my ubuntu server I run the following command:
python -c 'import os; os.kill(5555, 0)'
This is done so that I can see if pid 5555 is running. From my understanding this should raise an OSError if the pid is not running. This is not raising an OSError for me which means it should be a running process. However when I run:
ps aux |...
Here's one for ya. Upon a forced quit of the Finder with unsuccessful relaunch, "killall Finder" in terminal returns:
"No matching processes belonging to you were found"
Oddly enough, the PID for finder does actually show up after a "ps -A" to reveal all processes. But the time is perpetually listed as 0:00:00, upon repeated PID listi...
Does anyone know how to get the PID of the top active window and then how to get the properties of the window using the PID? I mean properties like process name, program name, etc.
I'm using Qt under Linux (Ubuntu 9.10).
...
I have a script vbs wich redirect some data to the stdin of myApp (written in C in Windows).
If myApp was already launched before myApp finds the PID of the first myApp session and redirects the input received via stdin to the stdin of the first session of myApp which handles the stdin.
So when myApp receives a stdin and no other instanc...
I have next command to run from my AIR application:
chp.exe cmd /d /c ""process.bat" "params.tmp" > "log.tmp" 2>&1 && echo 0 > status.tmp" || echo 1 > "status.tmp""
It creates background invisible process and logs output and exit status of the process.bat to the log.tmp
and status.tmp.
chp.exe is a "Create Hidden Process" program (...