summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorMike Vink <ivi@vinkies.net>2025-03-16 14:47:51 +0000
committerMike Vink <ivi@vinkies.net>2025-03-16 14:47:51 +0000
commitf97604691d2741e7c5ead501669070cbfbcf9885 (patch)
tree4f60025c00b7cb3e2f9f5f906f81f879a1201d4e /.local/bin
parentcfd4078df7f09db64a4309abadfd6dd08287929b (diff)
add container scripts
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/bootstrap-container3
-rwxr-xr-x.local/bin/collect-docker-execers5
-rwxr-xr-x.local/bin/pns2
-rwxr-xr-x.local/bin/write-docker-execers2
4 files changed, 12 insertions, 0 deletions
diff --git a/.local/bin/bootstrap-container b/.local/bin/bootstrap-container
new file mode 100755
index 0000000..294d138
--- /dev/null
+++ b/.local/bin/bootstrap-container
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "/Users/ivi/.okshnew/execers" | entr -n collect-docker-execers /_ &
+sleep infinity
diff --git a/.local/bin/collect-docker-execers b/.local/bin/collect-docker-execers
new file mode 100755
index 0000000..dd4b458
--- /dev/null
+++ b/.local/bin/collect-docker-execers
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -- $(cat "$1")
+if [ $# -gt 0 ]
+then eval "ps eax -o pid,ppid,user,cmd | grep '^\s\+[0-9]\+\s\+0\s.*' | grep -v -e '^\s\+1\+\s\+0\s' $(for pid; do printf -- '-e HOSTPID=%s ' "$pid"; done) | sed -En 's/^\s+([0-9]+).*/\1/p' | xargs -r kill -s SIGKILL"
+fi
diff --git a/.local/bin/pns b/.local/bin/pns
new file mode 100755
index 0000000..1d31dc3
--- /dev/null
+++ b/.local/bin/pns
@@ -0,0 +1,2 @@
+#!/bin/sh
+oksh -c 'pn exec bootstrap-container &'
diff --git a/.local/bin/write-docker-execers b/.local/bin/write-docker-execers
new file mode 100755
index 0000000..d26e6ba
--- /dev/null
+++ b/.local/bin/write-docker-execers
@@ -0,0 +1,2 @@
+#!/bin/sh
+ps Aeww | grep 'docker exec' | grep -o 'HOSTPID=\S*' | cut -d= -f2