mirror of
https://github.com/notwa/rc
synced 2024-07-02 11:47:12 -07:00
add screen handling crap
This commit is contained in:
parent
8f730162ba
commit
84b70ffc02
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 New Issue
Block a user