mirror of
https://github.com/notwa/rc
synced 2024-11-05 03:29:02 -08:00
Merge branch 'master' of github.com:notwa/rc
This commit is contained in:
commit
ff2deb260e
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