Is relying only on a lock file a good way to tell if a process is running a program?

Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I originally thought that ensuring singleton instance of running a program is based on testing existing of a lock file, or some other way which is entirely dependent on the lock files.
When I read a reply using pid file and also another reply using flock, I found that both ways don't remove the lock files or entirely depend on the lock files. The pid stored in a pdf file is used for matching existing processes, and a flock file doesn't seem to have any difference when a process that creates the flock file is still running and when such a process finishes running.
I also mentioned if we can tell if a process is running a program
by only looking at the flock lock file Can we tell if a command is being run by a process or not, by looking at the flock lock file alone?
by existence of pid file Does pid file work by assuming pid is not usable?
Thanks.
lock flock
add a comment |Â
up vote
-1
down vote
favorite
I originally thought that ensuring singleton instance of running a program is based on testing existing of a lock file, or some other way which is entirely dependent on the lock files.
When I read a reply using pid file and also another reply using flock, I found that both ways don't remove the lock files or entirely depend on the lock files. The pid stored in a pdf file is used for matching existing processes, and a flock file doesn't seem to have any difference when a process that creates the flock file is still running and when such a process finishes running.
I also mentioned if we can tell if a process is running a program
by only looking at the flock lock file Can we tell if a command is being run by a process or not, by looking at the flock lock file alone?
by existence of pid file Does pid file work by assuming pid is not usable?
Thanks.
lock flock
unix.stackexchange.com/questions/12815
â JdeBP
5 mins ago
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I originally thought that ensuring singleton instance of running a program is based on testing existing of a lock file, or some other way which is entirely dependent on the lock files.
When I read a reply using pid file and also another reply using flock, I found that both ways don't remove the lock files or entirely depend on the lock files. The pid stored in a pdf file is used for matching existing processes, and a flock file doesn't seem to have any difference when a process that creates the flock file is still running and when such a process finishes running.
I also mentioned if we can tell if a process is running a program
by only looking at the flock lock file Can we tell if a command is being run by a process or not, by looking at the flock lock file alone?
by existence of pid file Does pid file work by assuming pid is not usable?
Thanks.
lock flock
I originally thought that ensuring singleton instance of running a program is based on testing existing of a lock file, or some other way which is entirely dependent on the lock files.
When I read a reply using pid file and also another reply using flock, I found that both ways don't remove the lock files or entirely depend on the lock files. The pid stored in a pdf file is used for matching existing processes, and a flock file doesn't seem to have any difference when a process that creates the flock file is still running and when such a process finishes running.
I also mentioned if we can tell if a process is running a program
by only looking at the flock lock file Can we tell if a command is being run by a process or not, by looking at the flock lock file alone?
by existence of pid file Does pid file work by assuming pid is not usable?
Thanks.
lock flock
lock flock
asked 22 mins ago
Tim
24.4k69238426
24.4k69238426
unix.stackexchange.com/questions/12815
â JdeBP
5 mins ago
add a comment |Â
unix.stackexchange.com/questions/12815
â JdeBP
5 mins ago
unix.stackexchange.com/questions/12815
â JdeBP
5 mins ago
unix.stackexchange.com/questions/12815
â JdeBP
5 mins ago
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478719%2fis-relying-only-on-a-lock-file-a-good-way-to-tell-if-a-process-is-running-a-prog%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
unix.stackexchange.com/questions/12815
â JdeBP
5 mins ago