Assistance with Case Variable
by orangepeel190 from LinuxQuestions.org on (#57GZT)
Hello,
I have just noticed an issue with one of my scripts and I am trying to modify it to allow a backup server response into a case response.
Basically, it is looking at the website header files and returning the response from the server (either 200, 301, 304, 404 etc etc)
I have now seen a the script not displaying a response from the Primary Server, however it is returning a response from the Backup Server.
This part is working well ....
Now, this is where I am seeking assistance
I have a case up and running, and depending on the web response, triggers an action. I am wanting to bring in both the primary and backup responses to the loop to trigger the action.
response = primary server
An extract:
Code:# Run the Search Function
get_headers
case "$response" in
200)
do_somethingHow can I bring in the backup server responses into the loop and trigger the desired result?
I am thinking along the lines of (in plain english) ...
# Run the Search Function
get_headers
case "$response" and/or "$response_backup" in
200)
do_something
I am stuck on the and/or bit and what code to use here ... if it is possible?
I have searched around (when the search function works) as well as the web, and maybe Im searching the wrong trigger words
Any ideas/suggestions?
Maybe a CASE statement is not the best in this circumstance?


I have just noticed an issue with one of my scripts and I am trying to modify it to allow a backup server response into a case response.
Basically, it is looking at the website header files and returning the response from the server (either 200, 301, 304, 404 etc etc)
I have now seen a the script not displaying a response from the Primary Server, however it is returning a response from the Backup Server.
This part is working well ....
Now, this is where I am seeking assistance
I have a case up and running, and depending on the web response, triggers an action. I am wanting to bring in both the primary and backup responses to the loop to trigger the action.
response = primary server
An extract:
Code:# Run the Search Function
get_headers
case "$response" in
200)
do_somethingHow can I bring in the backup server responses into the loop and trigger the desired result?
I am thinking along the lines of (in plain english) ...
# Run the Search Function
get_headers
case "$response" and/or "$response_backup" in
200)
do_something
I am stuck on the and/or bit and what code to use here ... if it is possible?
I have searched around (when the search function works) as well as the web, and maybe Im searching the wrong trigger words
Any ideas/suggestions?
Maybe a CASE statement is not the best in this circumstance?