Need help implementing a timout in my Shell Script for RHEL6
Hey Guys,
My problem:
I have a script that will be querying the database every minute to see if it gets a response, the response its querying for is "UP" in a table i made called dbup in the database.
Now, I am trying to add the component to implement a timeout if the script does not get a response from the server and skip to next line etc.
I would like to implement it either at the DB layer because of issues we have had with the product.
We want to skip the -->
I assign the variable query_select1, before I query DB to assign it to STRING "UP.
Any help would be appreciated. NOTE: we would like to avoid killing the script, but if necessary I might be ok with killing it and then sending message to myself that process got killed this is why.
But I really could use a solution to this because When the variable ="down" stays the same and doesn't get changed to "UP" from Database, then it gets passed onto the auto generated emails we have setup.
If there are other methods that I haven't thought of let me know as well.
RHEL6
Last edited by mo_VERTICASQL; 07-30-2014 at 12:37 PM..
You can have subshells that watch each other, so if the query loop has not written a new output to the output file for N seconds, another looping watcher can decide it is hung and kill and restart it. A third looping watcher-publisher can declare it down until there is a fresh 'up', and vice versa, and publish the status and status changes.
Ideally, I would like to implement less watcher scripts as a best practice (This is an enterprise environment)
and the script I am going to implement will run every minute so it might be an unnecessary load to do what you suggest.
If I am wrong or my assumptions in correct let me know.
and FYI, the script will be scheduled to run every 1 minute, in background.
It has a LOT of temporary variables too -so the cleanup process more complicated.
---------- Post updated at 12:03 PM ---------- Previous update was at 12:00 PM ----------
also I found this googling,
is this something that might work or no?
---------- Post updated at 12:06 PM ---------- Previous update was at 12:03 PM ----------
DGPICKETT, for the watcher script you describe can you expand on the logic for me I am bit of an intermediate shell guy.
like I mean if its not too much could you expand:
1.....
2.....
3....
in terms of what you mean.
Thanks!
---------- Post updated at 12:14 PM ---------- Previous update was at 12:06 PM ----------
If I implement in my subshell the script running too long kill and email its just basically this right:
-----------------------------
(
##If runs for this time
##KILL MAIN.sh
##EMAIL NOTICE
)
MAIN.SH
------------------------------
---------- Post updated at 12:46 PM ---------- Previous update was at 12:14 PM ----------
Will this do as the watcher subshell ?
Last edited by Franklin52; 07-30-2014 at 03:01 PM..
Reason: fixed tags
Hello Experts,
Is it possible to implement linked list in shell scripting? is yes then how can we do it? Any working example is highly appreciated.
Thanks in advance. (4 Replies)
Hi,
Basically what I am trying to do is making multiple fields of the same type comma-separated.
i.e. for a data like this:
B00000 abc
B00001 abc,def
B00001 ghi
B00001 jkl
B00002 abc
B00002 def
B00003 xyz
Output should be like:
B00000 abc
B00001 abc,def,ghi,jkl... (20 Replies)
hi ,
i want write the script which automatically send an alert mail to my mail id when there is low memory available.
things which i am able to implement -:
i got the output of current memory status into one file . Than i break down the required coloumn and again send it in another file.
My... (1 Reply)
HI
I want to implement a control mechanism using Shell scripts .The intention is to have controlled number of jobs running in parallel
External process will kickstart 40 jobs in parallel .All the 40 jobs will call the same generic script with different parameter values .But at a... (4 Replies)
1. The problem statement, all variables and given/known data:
need to implement mkdir, chdir, mv, pwd
given a shell.cpp directory.cpp and some other files
this shell missing these commands, and i need to implement them inside the shell
2. Relevant commands, code, scripts,... (0 Replies)
Hi,
I am implementing a shell in C, with the following problem...
Suppose the shell is invoked from the command line as
>> myshell < test.in > test.out 2>&1
I have to execute the commands in test.in and redirect them to test.out
How does one detect in the main function that the shell... (1 Reply)
hello all,
i hv attached herewith my program to implement a simple interactive shell in C. no matter hw hard I try, I keep getting some errors. i need help - urgently !!
proj1test7.c: In function `parseCommand':
proj1test7.c:102: warning: assignment makes pointer from integer without a cast... (2 Replies)
I'm implementing a shell in C that supports piping, output redirection, and background processing, and a few other commands. I was wondering how I'd go about implementing the output redirection. So, I'd open a file and I'd fork and execute the command. But how would I get stdout into the file? Any... (10 Replies)
ok here is a little bit on what I am trying to do. I am logged into a saolaris 9 server and telnet to another server to run an application that sits on the second unix / linux server. This application can sit idle for an hour to two and any given time. During this time the telnet session timesout... (4 Replies)
I am led to understand that there when a port is bound for a tcp connection...once that connection is closed there is a timeout period before that port can be reused ... and the software I am using shows that. How long is this timeout - what affects it and is there anyway to reuce the timeout? (5 Replies)