diff options
Diffstat (limited to 'update-all.in')
-rw-r--r-- | update-all.in | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/update-all.in b/update-all.in index 7b33884..6d36bb2 100644 --- a/update-all.in +++ b/update-all.in @@ -8,6 +8,7 @@ usage() { >&2 printf 'usage:\n' >&2 printf ' %s\n' "${0##*/}" + >&2 printf ' %s -c\n' "${0##*/}" >&2 printf ' %s $id $tmpdir [cs]\n' "${0##*/}" exit 1 } @@ -50,6 +51,14 @@ if [ "$#" -eq 3 ]; then exit ${err} fi +if [ "$#" -eq 1 ] \ +&& [ "x$1" = 'x-c' ]; then + for system in "${!systems[@]}"; do + screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' + done + exit +fi + if [ "$#" -ne 0 ]; then usage fi @@ -62,12 +71,11 @@ pids=() for system in "${!systems[@]}"; do if [ -z "${DISPLAY}" ]; then screen -S update-all -d -m "${0}" "${system}" "${tmp_dir}" 's' - screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' else - urxvt -title "${systems["${system}"]}: update-me" -e "${0}" "${system}" "${tmp_dir}" & + urxvt -title "${systems["${system}"]}: update-me" -e "${0}" "${system}" "${tmp_dir}" 's' & pids+=($!) - screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' fi + screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' done if [ -z "${DISPLAY}" ]; then @@ -87,7 +95,7 @@ fi while [ -n "${pids[*]}" ]; do if [ -z "${DISPLAY}" ]; then for pid in "${pids[@]}"; do - if ! kill -0 "${pid}" >/dev/null 2>&1; then + if ! [ -d "/proc/${pid}" ]; then continue fi npids+=("${pid}") @@ -100,7 +108,7 @@ while [ -n "${pids[*]}" ]; do pids=( $( for pid in "${pids[@]}"; do - if kill -0 "${pid}" >/dev/null 2>&1; then + if [ -d "/proc/${pid}" ]; then printf '%s\n' "${pid}" fi done |