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.

Commit89b3b99

Browse files
committed
feat: use env value of variable SSHSUDOPASSWORD as password for sudo
1 parent8fa2060 commit89b3b99

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

‎README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ you cannot use `localhost` in `-h` parameter. You have to use a bridge between
292292
host OS and Docker Engine. By default, host IP is`172.17.0.1` in`docker0`
293293
network, but it vary depending on configuration. More information[here](https://nickjanetakis.com/blog/docker-tip-65-get-your-docker-hosts-ip-address-from-in-a-container).
294294

295+
If you use SSH connection to the Postgres server, where access to sudo has been
296+
restricted by password you can specify such password using environment
297+
variable SSHSUDOPASSWORD.
298+
295299
##Credits
296300

297301
Some reports are based on or inspired by useful queries created and improved by

‎checkup

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,11 @@ ssh() {
14601460
ssh_options="$ssh_options -S$ssh_master_socket$ssh_master_options"
14611461
fi
14621462

1463-
command ssh$ssh_options"$@"
1463+
if [["$@"==*"sudo"* ]]&& [[!-z${SSHSUDOPASSWORD+x} ]];then
1464+
commandecho"$SSHSUDOPASSWORD"|command ssh -tt$ssh_options"$@"
1465+
else
1466+
command ssh$ssh_options"$@"
1467+
fi
14641468
}
14651469

14661470
#######################################

‎resources/checks/A008_disk_usage_fstype.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ df_to_json() {
9191
#######################################
9292
print_df() {
9393
local path="$1"
94-
df_to_json"${path}"$(${CHECK_HOST_CMD}"sudo df -TPh\"${path}\" | tail -n +2")
94+
local df=$(${CHECK_HOST_CMD}"sudo df -TPh\"${path}\"")
95+
df=$(echo"$df"| grep -v"\[sudo\] password for"| tail -n +2)
96+
df_to_json"${path}"$df
9597
}
9698

9799
# json output starts here
@@ -132,7 +134,8 @@ echo "},"
132134
echo"\"fs_data\":{"
133135

134136
i=0
135-
points=$(${CHECK_HOST_CMD}"sudo df -TPh | tail -n +2")
137+
points=$(${CHECK_HOST_CMD}"sudo df -TPh")
138+
points=$(echo"$points"| grep -v"\[sudo\] password for"| tail -n +2)
136139
whileread -r line;do
137140
if [[$i-gt 0 ]];then
138141
echo",\"$i\":{"

‎resources/checks/D002_useful_linux_tools.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ check_list() {
3333
forutilin$list;do
3434
[["$cnt"-eq"0" ]]&& comma=""|| comma=","
3535
IFS="$SAVE_IFS"# non-standart IFS ruins ${CHECK_HOST_CMD}
36-
if$(${CHECK_HOST_CMD}"sudo which$util >/dev/null 2>&1");then
36+
local res=$(${CHECK_HOST_CMD}"sudo which$util 2>&1")
37+
res=$(echo"$res"| grep -v"\[sudo\] password for")
38+
if [["$res"!="" ]];then
3739
json="${json}${comma}\"$util\":\"yes\""
3840
else
3941
json="${json}${comma}\"$util\":\"\""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp