mirror of
https://github.com/CHN-beta/nixos.git
synced 2024-10-23 17:28:59 +08:00
fix xray stat
This commit is contained in:
parent
baf5c5c9e4
commit
647e9b4463
@ -586,9 +586,14 @@ inputs:
|
|||||||
message='xray:\n'
|
message='xray:\n'
|
||||||
for i in {0..${toString ((length userList) - 1)}}
|
for i in {0..${toString ((length userList) - 1)}}
|
||||||
do
|
do
|
||||||
traffic_bytes=$(${xray} api stats --server=127.0.0.1:6149 \
|
upload_bytes=$(${xray} api stats --server=127.0.0.1:6149 \
|
||||||
|
-name "user>>>''${i}@xray.chn.moe>>>traffic>>>uplink" | , jq '.stat.value' | sed 's/"//g')
|
||||||
|
[ -z "$upload_bytes" ] && upload_bytes=0
|
||||||
|
download_bytes=$(${xray} api stats --server=127.0.0.1:6149 \
|
||||||
-name "user>>>''${i}@xray.chn.moe>>>traffic>>>downlink" | , jq '.stat.value' | sed 's/"//g')
|
-name "user>>>''${i}@xray.chn.moe>>>traffic>>>downlink" | , jq '.stat.value' | sed 's/"//g')
|
||||||
message=$message"$i"'\t'$(echo | ${awk} "{printf \"%.3f\",0''${traffic_bytes}/1073741824}")'G\n'
|
[ -z "$download_bytes" ] && download_bytes=0
|
||||||
|
traffic_gb=$(echo | ${awk} "{printf \"%.3f\",(''${upload_bytes}+''${download_bytes})/1073741824}")
|
||||||
|
message="$message$i"'\t'"''${traffic_gb}"'G\n'
|
||||||
done
|
done
|
||||||
${curl} -X POST -H 'Content-Type: application/json' \
|
${curl} -X POST -H 'Content-Type: application/json' \
|
||||||
-d "{\"chat_id\": \"$(cat ${chat})\", \"text\": \"$message\"}" \
|
-d "{\"chat_id\": \"$(cat ${chat})\", \"text\": \"$message\"}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user