Questions tagged [pid]

Process Identifier (PID)

In computing, the process identifier (normally referred to as the process ID or just PID) is a number used by most operating system kernels (such as that of UNIX, Mac OS X or Microsoft Windows) to (temporarily) uniquely identify a process. This number may be used as a parameter in various function calls allowing processes to be manipulated, such as adjusting the process's priority or killing it altogether.

Source: wikipedia

105 questions
109
votes
8 answers

How to get pid of just started process

I want to start process (eg. myCommand) and get its pid (to allow to kill it later). I tried ps and filter by name, but I can not distinguish process by names myCommand ps ux | awk '// {print $2}' Because processes names are not…
rafalmag
  • 1,201
  • 2
  • 9
  • 8
62
votes
6 answers

What permissions are needed to write a PID file in /var/run?

On Ubuntu: touch: cannot touch `/var/run/test.pid': Permission denied I am starting start-stop-daemon and like to write the PID file in /var/run start-stop-daemon is run as my-program-user /var/run setting is drwxr-xr-x 9 root root I like to…
s5804
  • 745
  • 1
  • 6
  • 8
32
votes
4 answers

Given a PID on Windows - how do I find the command line instruction that executed it?

On a database, I can get a list of all the currently running processes, and the sql command that kicked them off. I'd like to do a similar thing on a windows box. I can get the list of processes, but not the command line that kicked them off. My…
Hawkeye
  • 2,669
  • 9
  • 30
  • 34
27
votes
4 answers

Directory in /var/run gets deleted after hard reboot

I keep my sphinx pid in /var/run/sphinx/searchd.pid but every time I hard reboot the directory /var/run/sphinx disappears and sphinx fails to start. Is there a way to make that directory stick or have it automatically created? How do people…
Tony Amoyal
25
votes
4 answers

MySQL server PID file could not be found

I can start MySQL fine, /usr/local/mysql/support-files/mysql.server start Starting MySQL SUCCESS! But any MySQL action after that I get the error: MySQL server PID file could not be found /usr/local/mysql/support-files/mysql.server…
simpleengine
  • 395
  • 1
  • 3
  • 6
18
votes
2 answers

How to find the .pid file for a given process

I'm setting up monit and want to monitor a given python application. Monit does this by looking at the .pid files for processes, but I don't know where this would be. I also tried creating my own simple executable and running it- here too I can't…
Yarin
  • 1,316
  • 8
  • 19
  • 31
15
votes
9 answers

Port 80 is being used by SYSTEM (PID 4), what is that?

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…
GiH
15
votes
6 answers

What's a proper way of checking if a PID is running?

I have a .pid file, and I need to check if the process is running. So far I found two options kill -0 `cat something.pid` which prints out an error if the pid isn't running. I know this can be redirected to /dev/null, but it makes me think that…
Jakub Arnold
  • 1,674
  • 10
  • 25
  • 33
15
votes
3 answers

What is the range of a PID on Linux and Solaris?

What is the maximum and minimum value for a PID (Process ID) on Linux and Solaris?
Graeme
  • 251
  • 1
  • 2
  • 5
15
votes
4 answers

The PID of a bash child proccess (imapsync) - how do you get it?

Can any one tell me how to get the PID of a command executed in bash. E.g. I have a bash script that runs imapsync. When the script is killed the imapsync process does not always get killed, so I'd like to be able to identify the PID of imapsync…
Jason Tan
  • 2,742
  • 2
  • 17
  • 24
14
votes
3 answers

Systemd drop-in fails to create PID file

I have a drop-in for systemd-machined at the path /etc/systemd/system/systemd-machined.service.d/10-machined-pid-file.conf. when I run systemctl status systemd-machined I do see the lines Drop-In: /etc/systemd/system/systemd-machined.service.d …
Christian Grabowski
  • 529
  • 1
  • 5
  • 17
14
votes
5 answers

how to get process file name from PID in MacOS?

Is it possible to get a file name of a process using PID? ps displays a lot of useful information about a process, but not a hint about a process executable file location.
grigoryvp
  • 3,415
  • 11
  • 38
  • 58
12
votes
3 answers

Can start-stop-daemon use environmental variables?

I need to daemonize a Windows app running in Wine, and create a pid in /var/run. Since it requires an X11 session to run, I need to make sure the $DISPLAY variable is set in the running user's environment. Assuming I already have a X11 session…
scottburton11
  • 123
  • 1
  • 1
  • 5
11
votes
6 answers

Are .pid files reliable for determining whether a process is running?

Many programs such as sshd create .pid files in /var/run/ that contain their process ID. Are these files reliable for determining whether a process is running? My guess is that these files are created manually by a process, and therefore will…
indiv
  • 235
  • 2
  • 10
10
votes
3 answers

Can I recover a nano process from a previous terminal?

My system crashed while I was in a nano session with unsaved changes. When I log back in via SSH I see the nano process still running when I do a ps. davidparks21@devdb1:/opt/frugg_batch$ ps -ef | grep nano 1001 31714 29481 0 18:32 pts/0 …
davidparks21
  • 878
  • 1
  • 11
  • 25
1
2 3 4 5 6 7