Skip to content

Commit 6498065

Browse files
committed
feat: bypass termbin if site is down
1 parent 9be745f commit 6498065

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

lgsm/modules/command_postdetails.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,27 @@ else
5858
fi
5959

6060
fn_print_dots "termbin.com"
61-
link=$(cat "${postdetailslog}" | nc termbin.com 9999 | tr -d '\n\0')
62-
fn_print_ok_nl "termbin.com for 30D"
63-
fn_script_log_pass "termbin.com for 30D"
64-
pdurl="${link}"
61+
link=$(cat "${postdetailslog}" | {
62+
nc -w 3 termbin.com 9999
63+
echo $? > /tmp/nc_exit_status
64+
} | tr -d '\n\0')
65+
nc_exit_status=$(cat /tmp/nc_exit_status)
66+
if [ "${nc_exit_status}" -ne 0 ]; then
67+
fn_print_error_nl "Failed to post to termbin.com"
68+
fn_script_log_error "Failed to post to termbin.com"
69+
else
70+
fn_print_ok_nl "termbin.com for 30D"
71+
fn_script_log_pass "termbin.com for 30D"
72+
pdurl="${link}"
6573

66-
if [ "${firstcommandname}" == "POST-DETAILS" ]; then
67-
echo -e ""
68-
echo -e "Please share the following url for support: "
69-
echo -e "${italic}${pdurl}${default}"
74+
if [ "${firstcommandname}" == "POST-DETAILS" ]; then
75+
echo -e ""
76+
echo -e "Please share the following url for support: "
77+
echo -e "${italic}${pdurl}${default}"
78+
fi
79+
fn_script_log_info "${pdurl}"
80+
alerturl="${pdurl}"
7081
fi
71-
fn_script_log_info "${pdurl}"
72-
alerturl="${pdurl}"
7382

7483
if [ -z "${exitbypass}" ]; then
7584
core_exit.sh

0 commit comments

Comments
 (0)