4 deleted 35 characters in body
source | link

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't trustworthy, because sometimes some of the children would end up with a PPID of 1.

Now, what I'm looking for is how can I run the following function in the background, and have the function and curl all in the same group, and later kill this script if it gets stuck, killing all its children that were left in the background:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        echo Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    download $url >$url &
done
wait

I know there's no need for this function download, but I included here because it is a function I use many times in this script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors, curlit also gets stuck, which may be a bug in curl itself.

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't trustworthy, because sometimes some of the children would end up with a PPID of 1.

Now, what I'm looking for is how can I run the following function in the background, and have the function and curl all in the same group, and later kill this script if it gets stuck, killing all its children that were left in the background:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        echo Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    download $url >$url &
done
wait

I know there's no need for this function download, but I included here because it is a function I use many times in this script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors, curl also gets stuck, which may be a bug in curl itself.

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't trustworthy, because sometimes some of the children would end up with a PPID of 1.

Now, what I'm looking for is how can I run the following function in the background, and have the function and curl all in the same group, and later kill this script if it gets stuck, killing all its children that were left in the background:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        echo Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    download $url >$url &
done
wait

I know there's no need for this function download, but I included here because it is a function I use many times in this script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors, it also gets stuck.

3 Clarify the question
source | link

Launch background processes in father'sone group and later kill them all

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't worth the hassletrustworthy, because sometimes some of the children would end up with a PPID of 1, depending on the circumstances.

Now, what I'm looking for is how can I run the following set of commands from a scriptfunction in the background, and have the function and curl all in the same group, and later kill this script if it gets stuck after some time, killing all its download and curl children that were left in the background:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        printecho Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    compressdownload $url >$url &
done
wait

I know there's no need for such athis function download, but I included here because it is a function I use many times in thethis script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors (and I'm having a lot lately), curl also gets stuck (not only the sleep 5 loop), which may be a bug in curl itself.

Launch background processes in father's group and kill them all

The other day I tried writing a script that would kill a PID and all its children, but after spending some time on it, I decided it wasn't worth the hassle, because some of the children would end up with a PPID of 1, depending on the circumstances.

Now, what I'm looking for is how can I run the following set of commands from a script all in the same group, and later kill this script if it gets stuck after some time, killing all its download and curl children:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        print Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    compress $url >$url &
done
wait

I know there's no need for such a function download, but I included here because it is a function I use many times in the script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors (and I'm having a lot lately), curl also gets stuck (not only the sleep 5 loop).

Launch background processes in one group and later kill them all

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't trustworthy, because sometimes some of the children would end up with a PPID of 1.

Now, what I'm looking for is how can I run the following function in the background, and have the function and curl all in the same group, and later kill this script if it gets stuck, killing all its children that were left in the background:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        echo Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    download $url >$url &
done
wait

I know there's no need for this function download, but I included here because it is a function I use many times in this script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors, curl also gets stuck, which may be a bug in curl itself.

2 added 4 characters in body
source | link

The other day I tried writing a script that would kill a PID and all its children, but after spending some time on it, I decided it wasn't worth the hassle, because some of the children would end up with a PPID of 1, depending on the circumstances.

Now, what I'm looking for is how can I run the following set of commands from a script all in the same groupgroup, and later kill this script if it gets stuck after some time, killing all its download and curl children:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        print Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    compress $url >$url &
done
wait

I know there's no need for such a function download, but I included here because it is a function I use many times in the script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors (and I'm having a lot lately), curl also gets stuck (not only the sleep 5 loop).

The other day I tried writing a script that would kill a PID and all its children, but after spending some time on it, I decided it wasn't worth the hassle, because some of the children would end up with a PPID of 1, depending on the circumstances.

Now, what I'm looking for is how can I run the following set of commands from a script all in the same group, and later kill this script if it gets stuck after some time, killing all its download and curl children:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        print Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    compress $url >$url &
done
wait

I know there's no need for such a function download, but I included here because it is a function I use many times in the script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors (and I'm having a lot lately), curl also gets stuck (not only the sleep 5 loop).

The other day I tried writing a script that would kill a PID and all its children, but after spending some time on it, I decided it wasn't worth the hassle, because some of the children would end up with a PPID of 1, depending on the circumstances.

Now, what I'm looking for is how can I run the following set of commands from a script all in the same group, and later kill this script if it gets stuck after some time, killing all its download and curl children:

download(){
    until curl -s -S -L -A Mozilla/5.0 -m 300 "$@"; do
        print Retrying in 5 seconds... >&2
        sleep 5
    done
}

for url in foo.com bar.com baz.com; do
    compress $url >$url &
done
wait

I know there's no need for such a function download, but I included here because it is a function I use many times in the script. Also, I'm giving a max time limit of 300 to curl, but depending on some network errors (and I'm having a lot lately), curl also gets stuck (not only the sleep 5 loop).

1
source | link