Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit0668df9

Browse files
committed
fix: mr remarks
1 parentf5a1902 commit0668df9

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

‎checkup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ ssh() {
14751475
ssh_options="$ssh_options -S$ssh_master_socket$ssh_master_options"
14761476
fi
14771477

1478-
if [["$@"==*"sudo"* ]]&& [[!-z${SSHSUDOPASSWORD+x} ]];then
1478+
if [["$@"==*"sudo"* ]]&& [[!-z${SSHSUDOPASSWORD+x} ]];then
14791479
commandecho"$SSHSUDOPASSWORD"|command ssh -q -tt$ssh_options"$@"
14801480
else
14811481
command ssh$ssh_options"$@"

‎resources/checks/A008_disk_usage_fstype.sh

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,27 @@ fi
6666
# json
6767
#######################################
6868
df_to_json() {
69-
if [[!-z${1+x} ]]&& [[!-z${2+x} ]]&& [[!-z${3+x} ]]&& [[!-z${4+x} ]]&&
70-
[[!-z${5+x} ]]&& [[!-z${6+x} ]]&& [[!-z${7+x} ]]&& [[!-z${8+x} ]];then
71-
echo"{
72-
\"fstype\":\"$3\",
73-
\"size\":\"$4\",
74-
\"avail\":\"$6\",
75-
\"used\":\"$5\",
76-
\"use_percent\":\"$7\",
77-
\"mount_point\":\"$8\",
78-
\"path\":\"$1\",
79-
\"device\":\"$2\"
80-
}"
69+
if [[!-z${1+x} ]]&&
70+
[[!-z${2+x} ]]&&
71+
[[!-z${3+x} ]]&&
72+
[[!-z${4+x} ]]&&
73+
[[!-z${5+x} ]]&&
74+
[[!-z${6+x} ]]&&
75+
[[!-z${7+x} ]]&&
76+
[[!-z${8+x} ]];
77+
then
78+
cat -<<JSON
79+
{
80+
"fstype": "$3",
81+
"size": "$4",
82+
"avail": "$6",
83+
"used": "$5",
84+
"use_percent": "$7",
85+
"mount_point": "$8",
86+
"path": "$1",
87+
"device": "$2"
88+
}
89+
JSON
8190
else
8291
errmsg"ERROR: Wrong result of 'sudo df' command"
8392
exit 1
@@ -98,14 +107,14 @@ df_to_json() {
98107
#######################################
99108
print_df() {
100109
local path="$1"
101-
localrawDf=$(${CHECK_HOST_CMD}"sudo df -TPh\"${path}\"")
102-
df=$(echo"$rawDf"| grep -v"\[sudo\] password for"| tail -n 1)
110+
localraw_df=$(${CHECK_HOST_CMD}"sudo df -TPh\"${path}\"")
111+
df=$(echo"$raw_df"| grep -v"\[sudo\] password for"| tail -n 1)
103112

104113
if df_to_json"${path}"$df;then
105-
rawDf=""
114+
raw_df=""
106115
else
107116
echo"null"
108-
errmsg"Cannot get disk information. 'sudo df' returned: '$rawDf'"
117+
errmsg"Cannot get disk information. 'sudo df' returned: '$raw_df'"
109118
fi
110119
}
111120

@@ -159,16 +168,20 @@ while read -r line; do
159168
else
160169
echo"\"$i\":{"
161170
fi
162-
echo"\"fstype\":\"${params[1]}\",
163-
\"size\":\"${params[2]}\",
164-
\"avail\":\"${params[4]}\",
165-
\"used\":\"${params[3]}\",
166-
\"use_percent\":\"${params[5]}\",
167-
\"mount_point\":\"${params[6]}\",
168-
\"path\":\"${params[6]}\",
169-
\"device\":\"${params[0]}\"
170-
}"
171+
172+
cat -<<JSON
173+
"fstype": "${params[1]}",
174+
"size": "${params[2]}",
175+
"avail": "${params[4]}",
176+
"used": "${params[3]}",
177+
"use_percent": "${params[5]}",
178+
"mount_point": "${params[6]}",
179+
"path": "${params[6]}",
180+
"device": "${params[0]}"
181+
}
182+
JSON
171183
fi;
172-
let i=$i+1
184+
185+
i=$((i+1))
173186
done<<<"$points"
174187
echo"}}"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp