1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 05:29:02 -08:00

Merge branch 'master' of github.com:notwa/rc

This commit is contained in:
Connor Olding 2015-12-06 12:38:33 -08:00
commit ff2deb260e
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 "$@"