A pidfile is a file containing the process ID of a running program.

learn more… | top users | synonyms

1
vote
1answer
28 views

Process id of a command ran by an user

Consider i am running just some basic command.. ls Now would the above command have a pid, when it was getting executed? If yes, then how can i determine that pid? when i try echo $! right ...
1
vote
4answers
542 views

Write program output to log file containing PID in its name

How can I start a program and write its output to a log file, where the log file contains the PID in its name? I tried program_a > log_$! which doesn't work since $! is the PID of the last ...
1
vote
2answers
826 views

Writing own daemon. systemd error: Failed to read PID from file: Invalid argument

I'm trying to write own daemon a la very simple MPD (it's operating systems laboratory work). I made it work: it starts like a daemon (output of ps): 1 14877 14877 14877 ? -1 Ss 0 ...
0
votes
1answer
384 views

How to get pid of su --session-command file thats ran on there [closed]

This line ran in a script su --session-command="$javaCommandLine & >>$serviceLogFile 2>&1 & echo \$! >$pidFile" $serviceUser || return 1 pid="$(<$pidFile)" echo $pid The ...
1
vote
1answer
344 views

Startscript: using $! to create pidfile - returning wrong pid (off by one) occasionally

We have 3 instances of redis running on a test server. For some reason, our start script which starts redis can write the wrong pid to a file. Here is what it's doing: su redis -c "redis-server ...
4
votes
1answer
1k views

start-stop-daemon makes cron pidfile with wrong pid

I have an init.d script to start crond which specifies the following for start(): start-stop-daemon -S --quiet --make-pidfile --pidfile /var/run/crond.pid --background --exec /usr/sbin/crond ...
2
votes
1answer
184 views

How to demonstrate invalid PID assumptions?

It seems many programmers are happy with saving a PID to a file, and then later read and use the PID as if it was guaranteed to be the same process. It seems the general idea is that the odds are good ...
3
votes
6answers
386 views

Fastest way of finding files which contain exclusively some text

I'm trying to figure out the best and fastest way of finding files whose content is specifically "something" Here's the reason: I have a process that I'm pretty sure stores its PID somewhere in a ...
3
votes
2answers
171 views

How to detect out-bound port from PID

I have several applications that run on random ports. How would I take the pid or the file location and find which port it is running on? Example of desired output: www-data/apache = 80 ...
2
votes
1answer
276 views

bind's path to 'named.pid' looks a bit weird after a not-so-smooth package installation

I had a fresh VPS hosting account running Ubuntu LTS (Lucid Lynx) with Plesk 10.2.0 (and etckeeper package) I used Plesk's web interface to install Plesk Health Monitor. It took two attempts because ...
19
votes
3answers
13k views

What are pid and lock files for?

I often see that programs specify pid and lock files. And I'm not quite sure what they do. For example, when compiling nginx: --pid-path=/var/run/nginx.pid \ --lock-path=/var/lock/nginx.lock \ Can ...