From 41ca116a705f9548687e198ce515a30141d89ecb Mon Sep 17 00:00:00 2001 From: Lockszmith Date: Sun, 26 Jun 2022 22:43:06 -0400 Subject: [PATCH] Added truecharts (TrueNAS SCALE) shortcuts --- _home/dot_sz.shrc.d/23_truecharts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 _home/dot_sz.shrc.d/23_truecharts diff --git a/_home/dot_sz.shrc.d/23_truecharts b/_home/dot_sz.shrc.d/23_truecharts new file mode 100644 index 0000000..499bed0 --- /dev/null +++ b/_home/dot_sz.shrc.d/23_truecharts @@ -0,0 +1,20 @@ +if [[ -x "/mnt/szmedia/_apps.data/_scripts/truetool/truetool.sh" ]]; then + function truetool() { + pushd /mnt/szmedia/_apps.data/_scripts/truetool > /dev/null + sudo ./truetool.sh "${@}" + popd > /dev/null + } + + function truedcx() { + docker exec -it $(docker ps --filter "name=$1" -q) $2 + } + function true-docker-id() { + docker ps --filter "name=$1" -q + } + function true-hostname() { + local ID=$(true-docker-id $1) + local autoHostname=$(docker inspect --format="{{ .Config.Hostname }}" $ID) + local contIP=$(docker exec $ID cat /etc/hosts | grep $autoHostname | awk '{print $1}') + docker exec $ID nslookup $contIP | tail +4 | sed 's/^[0-9]\+.*name = [-0-9]\+\.//' + } +fi