Sponsored Content
Full Discussion: Script help
Homework and Emergencies Emergency UNIX and Linux Support Script help Post 302512782 by jacki on Monday 11th of April 2011 05:07:28 PM
Old 04-11-2011
Thanks Mirni,

Here is the code I have come up with -
Code:
#!/bin/sh

OP=0

exec <"/fs1/ainuser/ain/user-1/list"

while true
do
        read APP
                if [ "$APP" = "" ]
                then
                        exit $OP
                fi

        read URL
                if [ "$URL" = "" ]
                then
                        echo "ERROR no URL defined for $APP" >&2
                        exit 2
                fi

        sleep 3

        echo "Checking $APP: "
        curl $URL |grep -q -i alive
        x=$?
                if [ ${x} -eq 0 ]
                then
                        echo "App is alive : `date`"
                else
                        echo "$APP is down in env-1" | mail -s "$APP is down in env-1" testalert@email.com
                fi
done

Now I want to test the viability of the URL atleast 6 times with 3 seconds intervals and if it fails 4 times out of 6 then send the email.

I am really struggling on this one.. please help!!

Thanks,
Jack.

---------- Post updated at 04:07 PM ---------- Previous update was at 02:32 PM ----------

please help!
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

5. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
CURLOPT_TCP_KEEPIDLE(3) 				     curl_easy_setopt options					   CURLOPT_TCP_KEEPIDLE(3)

NAME
CURLOPT_TCP_KEEPIDLE - set TCP keep-alive idle time wait SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPIDLE, long delay); DESCRIPTION
Pass a long. Sets the delay, in seconds, that the operating system will wait while the connection is idle before sending keepalive probes. Not all operating systems support this option. DEFAULT
60 PROTOCOLS
All EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); /* enable TCP keep-alive for this transfer */ curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* set keep-alive idle time to 120 seconds */ curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L); /* interval time between keep-alive probes: 60 seconds */ curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L); curl_easy_perform(curl); } AVAILABILITY
Added in 7.25.0 RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. SEE ALSO
CURLOPT_TCP_KEEPALIVE(3), CURLOPT_TCP_KEEPINTVL(3), libcurl 7.54.0 January 02, 2017 CURLOPT_TCP_KEEPIDLE(3)
All times are GMT -4. The time now is 01:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy