1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-28 18:17:11 -07:00

add screen handling crap

This commit is contained in:
Connor Olding 2015-12-06 12:35:57 -08:00
parent 8f730162ba
commit 84b70ffc02
2 changed files with 26 additions and 0 deletions

15
sh/screeny Executable file
View 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
View 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 "$@"