Check server status
This commit is contained in:
13
pull_info.sh
13
pull_info.sh
@@ -1,6 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -o pipefail
|
||||||
echo "Get request cookie"
|
echo "Get request cookie"
|
||||||
#cookie=$(curl -D - -X GET http://192.168.1.42/wcd/index.html)
|
#cookie=$(curl -D - -X GET http://192.168.1.42/wcd/index.html)
|
||||||
cookie=$(cat request_example_1.txt) #testing
|
cookie=$(cat request_example_1.txt) #testing
|
||||||
|
exitCode="$?"
|
||||||
|
if [[ $exitCode == "7" ]];
|
||||||
|
then
|
||||||
|
echo "Server offline"
|
||||||
|
exit 0
|
||||||
|
elif [[ $exitCode != "0" ]];
|
||||||
|
then
|
||||||
|
echo "Something went wrong"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cookie=$(echo "$cookie" | grep Set-Cookie | grep -oP "ID=\K[^.]+" )
|
cookie=$(echo "$cookie" | grep Set-Cookie | grep -oP "ID=\K[^.]+" )
|
||||||
echo "$cookie"
|
echo "$cookie"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user