From: Bernhard Tittelbach Date: Thu, 26 Sep 2013 17:14:15 +0000 (+0000) Subject: tuerctlsh X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=b175a2a8da51c90898660eb5e5539082146cc733;p=svn42.git tuerctlsh --- diff --git a/tuerctlsh b/tuerctlsh index f41cb5f..de9adc6 100755 --- a/tuerctlsh +++ b/tuerctlsh @@ -6,14 +6,26 @@ # tuerctl ALL=(tuer) NOPASSWD: /flash/tuer/tuer_socat.sh setopt histsubstpattern -local TUERCHAN="sudo -u tuer /flash/tuer/tuer_socat.sh" +#local TUERCHAN="sudo -u tuer /flash/tuer/tuer_socat.sh" +local TUERCHAN="sudo -u tuer /flash/tuer/door_client_zmq" [[ $1 == "-c" ]] && shift if [[ -z $1 ]]; then ${(z)TUERCHAN} else - echo "Usable commands are: open, close, toggle, reset, status" - read -A CMD - ${(z)TUERCHAN} <<< "${${CMD[1]}:gs/[^a-zA-Z]//} ssh $1" + if [[ -z $SSH_ORIGINAL_COMMAND ]]; then + echo "Usable commands are: open, close, toggle status" + read -A CMD + else + CMD=("${=SSH_ORIGINAL_COMMAND}") + fi + if [[ $CMD == "status" ]]; then + local EXT="" + else + local EXT=" ssh $1" + fi + + ${(z)TUERCHAN} <<< "${${CMD[1]}:gs/[^a-zA-Z]//}${EXT}" + [[ $CMD == status ]] && sleep 1 fi