Questions tagged [wait]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
47 views

Can I wait for all forked processes from a command to finish?

Suppose running FOO stars BAR in the background. How can I wait for BAR to finish in the shell? I want a solution where I don’t change the internals of FOO (though I can grudgingly change BAR’s.). ...
2
votes
1answer
31 views

Question about a process lifecycle

I've managed to question myself about the wait(2) and _exit(2) system calls in a process lifecycle. My question about the wait(2) system call is... does the parent process issue it to the kernel? Or ...
0
votes
1answer
61 views

Why SIGCHLD signal was not ignored when using wait() functions?

When using wait functions the SIGCHLD signal was consumed by wait when executing sample 1.1 as shown below. sample 1.1 if (pid==0){ printf("child\n"); printf("%d\n",pid); } else{ printf("...
0
votes
0answers
48 views

Receiving SIGKILL when children terminate

I want to receive SIGKILL instead of SIGCHLD when any of my forked children terminate. On Linux this is possible by passing a different child termination signal to clone()1. Is this possible on any ...
0
votes
2answers
67 views

`wait` for processes started in a for loop, but not others started earlier

Suppose I have several running background tasks, but now I want to run two more background tasks, but wait only for the last two. For example: # long running commands sleep 60 & sleep 60 & # ...
0
votes
0answers
17 views

Red Hat: Back-Off time during failed authentication attempts

I am searching for a way to configure some sort of back-off or wait time during failed authentication attempts. The idea is that after each failed authentication attempt, the user has to wait an ...
2
votes
2answers
78 views

queue-like behaviour for multiple one-core jobs on single machine? [duplicate]

I've got an old Mac with 24 cores, and I'd like to run several hundred/thousands one-core jobs automatically. I've made a bash script that runs the processes in the background, but if I set too many ...
1
vote
1answer
618 views

Script hanging when using tee and wait, why?

I'm running a script which automates snapraid for my NAS server. It's a script I found online and it was working without issue on Debian 9. I updated to Debian 10 last week and the script now hangs in ...
3
votes
1answer
202 views

Kill the child process in a child xterm but not xterm

I'm new to Linux. I have python scripts in different files, each one performing a desired function. foo1.py foo2.py foo3.py Each one of these scripts should do cleanup before being terminated. ...
3
votes
2answers
129 views

Regain ability to use ^C to close backgrounded then (effectively) foregrounded processes

In the interactive console, pressing ^C on zenity --info & fg closes the Zenity window. One can only use zenity --info & wait in a script. But ^C doesn't close the Zenity window in this case. ...
0
votes
1answer
424 views

how signals are handled in linux kernel [closed]

My question is about signals and handling them inside the operating system kernel. I know that every process has it own signal_handler() table: a 31 bit array for signals (pending_signals), and when a ...
1
vote
0answers
629 views

How to wait for the execution of a python script inside shell script?

I want to mount another root partition, edit the grub.cfg file with a python script and afterwards umount the partition again. How can I wait for the python script to finish and check if the partition ...
3
votes
1answer
445 views

What does the `-f' option do for `wait' versus the default behaviour?

Bash 5.0 includes a new -f option for wait:[1] j. The `wait' builtin now has a `-f' option, which signfies to wait until the specified job or process terminates, instead of waiting until it ...
0
votes
2answers
2k views

Why should parent process wait (to terminate) until all of its child process terminates?

I know there is no enforcement for the parent process to wait until all its child process terminates. However it's a convention followed. Furthermore, I know that if parent process terminates before ...
0
votes
1answer
286 views

tmux send-keys confirm ssh tunnel is closed (after sending multiple commands to the remote host) before proceeding

there is an answer here about tmux using wait-for and LocalCommand to wait until the SSH connection is established before continuing, but I needed a way to have tmux wait for the ssh session to be ...
7
votes
3answers
2k views

sleep, wait and Ctrl+C propagation

If I have the following shell script sleep 30s And I hit Ctrl+C when the shell script is running, the sleep dies with it. If I have the following shell script sleep 30s & wait And I hit Ctrl+...
0
votes
1answer
96 views

How can I make `enscript` block till the printer finishes its job?

The following command will create a pdf file under ~/PDF/: enscript -B -P PDF bloom.c I want to move the output pdf file here ...
-1
votes
2answers
480 views

Wait command works when pid doesn't exists

I'm facing an unexpected behaviour of the wait builtin. ~ ❯ sleep 1 & [1] 72009 ~ ❯ [1] + 72009 done sleep 1 ~ ❯ wait 72009 ~ ❯ echo $? 0 Although the PID doesn't exist anymore wait ...
0
votes
2answers
474 views

Use waitpid for child having groupid 1

I searched a lot but didn't find a solution. So it can be silly question. The format of waitpid is pid_t waitpid (pid_t pid, int *status, int options) The pid parameter specifies exactly which ...
2
votes
1answer
3k views

How do I wait for nohup jobs to finish within a shell script?

I have the following script: echo "$wk" | while read -r a b; do counter=$(($counter+1)) nohup sh -c 'impala-shell -d nielsen -f query.sql --var=dt=$a --var=incre=$b; echo $a,$?>>$...
2
votes
3answers
1k views

Bash script to wait for a process to finish on multiple servers [duplicate]

I wanted to ssh to multiple servers remotely and check whether any processes running on those servers and wait until the process to get finished. I have written the below code but this checks only for ...
2
votes
1answer
392 views

Run subshells in parallel and collect exit codes

I have the following, I thought it ran the subshells in parallel, but it actually seems to run them in series, and I cannot figure out why: #!/usr/bin/env bash set -e; set -m # allow for job control ...
12
votes
2answers
33k views

Run commands in parallel and wait for one group of commands to finish before starting the next

I have script including multiple commands. How can I group commands to run together ( I want to make several groups of commands. Within each group, the commands should run in parallel (at the same ...