[SOLVED] Detect process with constantly changing ID
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Does it generate any messages to a logfile when it "fails" and restarts?
You do not say what process invokes software originally, whether it works through some directory of images, is it cron driven or attended, etc.
Suggestions might be to tail messages and look for repetitions, or modify the software to create a lockfile based on or including the image filename which would block or abort, or maybe write a wrapper script to detect and abort.
If PID (process info) is the ONLY way of identifying it, then write a script to ps | grep | compare last ? fail : continue | save last
First of all, you should find out who (which user) runs this program, what does it do (or is it supposed to do), is this behaviour considered to be ok?
Parent and child share buffers and file descriptors. Maybe /tmp/image.jpg belongs to parent process forking in reincarnation of "software". I would try lsof for /tmp/image.pgn.
Wait, is the actual name of the binary program "software"? If so, simply remove the program-file, remove the user that owns it, and remove every other files of that user. It must be some idiot having fun with your computer.
How are you running this? Did you write "software".
Actually, forget that, you can write a program to run "software" from within a C program and check for signals. See this blog about a daemon and how to have it monitor the children. Start down at the chunk about creating child processes and monitoring them. Check exit status, and so forth.
And if something dies, it shouldn't be recreating itself, there's a controller, daemon, or service which is already monitoring it and restarting it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.