Questions tagged [pidfile]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

systemd[1]: Caught <SEGU>, dumped core as pid – core file replication issue

I'm having an issue with my CentOS VM server [CentOS Linux release 7.4.1708 (Core)] It will generate the error log as below randomly and cannot be stopped. We did not change/touch anything inside the ...
Irfan Izzunidin's user avatar
0 votes
1 answer
1k views

What exactly does it mean to run a process in the "background"?

I want to understand a little bit better, what a background process is. The question came to live as a result of reading this line of code: /usr/sbin/rsyslogd -niNONE & Source The documentations ...
Andrew Savinykh's user avatar
1 vote
1 answer
3k views

remove on stale pid file after power failure to allow software startup via systemd service

i got such situation there is a power failure the UPS battery is drained during power failure the servers in rack are shut off from power lose power is restored servers powering up and their os'es ...
ceph3us's user avatar
  • 587
0 votes
1 answer
376 views

How does this command with which to "refresh the syslog process" work?

On http://www.cs.newpaltz.edu/~easwaran/Resources/commands.html the following command is listed as being meant to "Refresh the syslog process": kill -1 `cat /var/run/syslogd.pid` I have ...
phk's user avatar
  • 5,963
3 votes
1 answer
1k views

How to check if process with pid X is the one you expect

In our application, we start some background processes. The pid of these processes is saved to a file. pids values are re-used when the maximum is reached or when the system is rebooted. How can I ...
carl verbiest's user avatar
0 votes
2 answers
551 views

Run foreground process until background process exited in shell

I'm running QEMU virtual machine in -daemonize mode and then spawn an arbitrary foreground (possibly interactive) process intended to interact with the QEMU instance. In general once foreground ...
reddot's user avatar
  • 276
0 votes
1 answer
476 views

Can't Use "stop" Command with Bash Script Running Python Script

I have a bash script that calls a Python script that I want running continuously in the background. I can start the bash script, and the Python script runs, but I can't stop it using the "stop&...
Alasdair's user avatar
0 votes
1 answer
2k views

How can I store PID into a file [closed]

I need to store the pid number in a file/files. How to do it?
user321453's user avatar
0 votes
0 answers
538 views

Does pid file work by assuming pid is not usable?

To use a pid file for ensuring singleton running instance of a program, I thought that when a process finishes running the program, it should remove the pid file, until I know it doesn't when reading ...
Tim's user avatar
  • 102k
0 votes
1 answer
1k views

no process in pidfile; found running, none killed

I'm working on an emailnotifier script on RaspberryPi which was written in Python. I've found a tutorial page, I've exactly copied the default code (which works fine with a simple "python ...
Thonny Python's user avatar
0 votes
2 answers
1k views

Kill process by fuser instead of pidfile?

Recently I developed the habit of killing processes with fuser -k -n tcp $PORT which can hardly kill the wrong process. I prefer this over fiddling with a pidfile that may or may not be still there ...
Harald's user avatar
  • 898
0 votes
0 answers
408 views

echo $! after starting process no PID

I have an init script that executes a jar file in the background, and I want to print the PID to a file. Using the following immediately after the execute command the file is created, but it is empty. ...
jbeaulau's user avatar
3 votes
1 answer
2k views

Check and Test Lock from other Process

I am trying to create a service wrapper (init.d script) around one of my favorite applications. The application creates both a PID and a lock file, and so I'm trying to use those to ensure that I can ...
palswim's user avatar
  • 5,187
0 votes
1 answer
621 views

atd dead but subsys locked

After I killed the atd process by hand (sudo kill <PID>), I can no longer start at jobs: [vagrant@localhost ~]$ echo ls | at 'now + 1 minute' job 6 at 2016-05-09 20:17 Can't open /var/run/atd....
Wildcard's user avatar
  • 36.5k
0 votes
1 answer
555 views

Haveged service won't run (dead pid)

So my system entropy is low on my centos 6 VM. (137) and I installed haveged, Yum install haveged But when I go to start the process it instantly dies: Process is dead but sub system is locked Of ...
Gordon Snappleweed's user avatar
2 votes
0 answers
12k views

CentOS 7 systemd service file (run python script) working, but logging errors?

I have an application written in python which I've used many times with CentOS 6, and am now setting it up on CentOS 7. I've created a systemd service file that contains the following: # # Systemd ...
tycoonbob's user avatar
2 votes
1 answer
745 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 after ...
Gokul's user avatar
  • 1,071
2 votes
4 answers
10k 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 ...
greole's user avatar
  • 239
3 votes
2 answers
7k 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:...
rominf's user avatar
  • 517
0 votes
1 answer
2k 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 ...
SSpoke's user avatar
  • 165
1 vote
1 answer
907 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 /...
JasonG's user avatar
  • 405
4 votes
1 answer
5k 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 However,...
trycatch's user avatar
  • 643
1 vote
1 answer
1k 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 ...
l0b0's user avatar
  • 51.5k
3 votes
6 answers
2k 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 ...
Savir's user avatar
  • 1,241
3 votes
2 answers
294 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 my-awesome-...
Joe John's user avatar
2 votes
1 answer
663 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 ...
JW01's user avatar
  • 541
106 votes
3 answers
105k 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 ...
Stann's user avatar
  • 2,209