I would like to do the following:
I want to link a process A to a file F, so:
- If F dissapears A crashes.
- F will only dissapear when A finishes.
Is this possible? Thank you very much.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should not avoid PIDs. They are process identifiers, and meant to be used.
Bash automatically monitors child processes it starts. The most recent background process id is maintained in $!. Bash also supports job controls using ‘%n’ syntax.
You can trap child procs status changes with trap SIGCHLD, and you can “wait” for one or all child processes to complete with the wait command.
Here is a rough approximation of your two process monitoring, which consists of “job1” and “job2” being started the the sample script: