Last active
June 4, 2019 09:40
-
-
Save kkamkou/0180c4230bf25b40b9e3f8c6f35d556a to your computer and use it in GitHub Desktop.
Revisions
-
kkamkou revised this gist
Jun 4, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Example: # script.sh /tmp/status [8080] [40] while true; do PERCENT=`(cat ${1} | grep "Load:" | cut -d" " -f2) 2>/dev/null` STATUS=`[[ -z "${PERCENT}" || "${PERCENT}" -gt ${3-79} ]] && echo "503" || echo "204"` echo -e "HTTP/1.1 ${STATUS} OK\r\n\r\n" | nc -l --send-only -p ${2-8080} 1>/dev/null done -
kkamkou created this gist
Jun 4, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ #!/usr/bin/env bash # Example: # script.sh 8080 /tmp/status [40] while true; do PERCENT=`(cat ${2} | grep "Load:" | cut -d" " -f2) 2>/dev/null` STATUS=`[[ -z "${PERCENT}" || "${PERCENT}" -gt ${3-79} ]] && echo "503" || echo "204"` echo -e "HTTP/1.1 ${STATUS} OK\r\n\r\n" | nc -l -N -p ${1} 1>/dev/null done