mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
don't screen if unscreen failed
This commit is contained in:
parent
6784de8750
commit
0aaf8ead84
2 changed files with 5 additions and 2 deletions
|
@ -7,9 +7,11 @@ screeny() {
|
||||||
pushd "$home" >/dev/null
|
pushd "$home" >/dev/null
|
||||||
local name="${1:?needs arg for screen name}"
|
local name="${1:?needs arg for screen name}"
|
||||||
shift
|
shift
|
||||||
~/sh/unscreen "$name"
|
~/sh/unscreen "$name" || return 1
|
||||||
|
echo screen -S "$name" -dm sudo -Hu "$user" "$@"
|
||||||
screen -S "$name" -dm sudo -Hu "$user" "$@"
|
screen -S "$name" -dm sudo -Hu "$user" "$@"
|
||||||
popd "$home" >/dev/null
|
popd "$home" >/dev/null
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
screeny "$@"
|
screeny "$@"
|
||||||
|
|
|
@ -4,8 +4,9 @@ unscreen() {
|
||||||
local pids="$(screen -ls | fgrep "$1" | cut -d. -f1)"
|
local pids="$(screen -ls | fgrep "$1" | cut -d. -f1)"
|
||||||
for pid in $=pids; do
|
for pid in $=pids; do
|
||||||
local ppid="$(ps h --ppid "$pid" -o pid)"
|
local ppid="$(ps h --ppid "$pid" -o pid)"
|
||||||
kill "$ppid"
|
kill "$ppid" || return 1
|
||||||
done
|
done
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
unscreen "$@"
|
unscreen "$@"
|
||||||
|
|
Loading…
Add table
Reference in a new issue