mirror of
https://github.com/notwa/rc
synced 2024-11-05 16:09:03 -08:00
add screen handling crap
This commit is contained in:
parent
8f730162ba
commit
84b70ffc02
2 changed files with 26 additions and 0 deletions
15
sh/screeny
Executable file
15
sh/screeny
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
screeny() {
|
||||
local user="${1:?needs arg for user name}"
|
||||
shift
|
||||
home="/home/$user"
|
||||
pushd "$home" >/dev/null
|
||||
local name="${1:?needs arg for screen name}"
|
||||
shift
|
||||
~/sh/unscreen "$name"
|
||||
screen -S "$name" -dm sudo -Hu "$user" "$@"
|
||||
popd "$home" >/dev/null
|
||||
}
|
||||
|
||||
screeny "$@"
|
11
sh/unscreen
Executable file
11
sh/unscreen
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
unscreen() {
|
||||
local pids="$(screen -ls | fgrep "$1" | cut -d. -f1)"
|
||||
for pid in $=pids; do
|
||||
local ppid="$(ps h --ppid "$pid" -o pid)"
|
||||
kill "$ppid"
|
||||
done
|
||||
}
|
||||
|
||||
unscreen "$@"
|
Loading…
Reference in a new issue