163 Star 1.1K Fork 275

GVP赵建辉 / rtty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sendcmd.sh 893 Bytes
一键复制 编辑 原始数据 按行查看 历史
赵建辉 提交于 2021-01-25 22:51 . fix sendcmd.sh
#!/bin/sh
# Your server's host and port
host=localhost
port=5913
# Your linux device's username and password
username="test"
password="test"
# Default wait 30s.
# If you don't care about the results, you can set it to 0, that is, don't wait
#wait=0
devid="test"
cmd="echo"
params='["Hello, Rtty"]'
resp=$(curl "http://$host:$port/cmd/$devid?wait=$wait" -d "{\"cmd\":\"$cmd\", \"params\": $params, \"username\": \"$username\", \"password\": \"$password\"}" 2>/dev/null)
[ "$wait" = "0" ] && exit 0
err=$(echo "$resp" | jq -r '.err')
if [ "$err" != "null" ];
then
msg=$(echo "$resp" | jq -r '.msg')
echo "err: $err"
echo "msg: $msg"
else
code=$(echo "$resp" | jq -r '.code')
stdout=$(echo "$resp" | jq -r '.stdout' | base64 -d)
stderr=$(echo "$resp" | jq -r '.stderr' | base64 -d)
echo "code: $code"
echo "stdout: $stdout"
echo "stderr: $stderr"
fi
C
1
https://gitee.com/zhaojh329/rtty.git
git@gitee.com:zhaojh329/rtty.git
zhaojh329
rtty
rtty
master

搜索帮助