Sponsored Content
Top Forums Shell Programming and Scripting Need help implementing a timout in my Shell Script for RHEL6 Post 302911150 by mo_VERTICASQL on Wednesday 30th of July 2014 11:31:25 AM
Old 07-30-2014
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.

Code:
query_select1="down"
-->query_select1= ##QUERY SELECT FROM DB 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..
 

10 More Discussions You Might Find Interesting

1. IP Networking

tcp timout

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)
Discussion started by: peter.herlihy
5 Replies

2. UNIX for Dummies Questions & Answers

Telnet timout question

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)
Discussion started by: Acleoma
4 Replies

3. Programming

Implementing a shell

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)
Discussion started by: ununium
10 Replies

4. Programming

need help in implementing simple interactive shell in C

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)
Discussion started by: nix1209
2 Replies

5. Programming

Implementing a shell in C

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)
Discussion started by: jacques83
1 Replies

6. Homework & Coursework Questions

implementing mkdir, chdir, mv, pwd inside a shell !

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)
Discussion started by: evantheking
0 Replies

7. Shell Programming and Scripting

Implementing Queue Using Shell scripts

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)
Discussion started by: police
4 Replies

8. Shell Programming and Scripting

Help with implementing available memory status script

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)
Discussion started by: abhinav dixit
1 Replies

9. Shell Programming and Scripting

Implementing Listagg like function in shell

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)
Discussion started by: prohank
20 Replies

10. Shell Programming and Scripting

Implementing linked list in shell scripting

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)
Discussion started by: mukulverma2408
4 Replies
DBD::Gofer::Transport::Base(3)				User Contributed Perl Documentation			    DBD::Gofer::Transport::Base(3)

NAME
DBD::Gofer::Transport::Base - base class for DBD::Gofer client transports SYNOPSIS
my $remote_dsn = "..." DBI->connect("dbi:Gofer:transport=...;url=...;timeout=...;retry_limit=...;dsn=$remote_dsn",...) or, enable by setting the DBI_AUTOPROXY environment variable: export DBI_AUTOPROXY='dbi:Gofer:transport=...;url=...' which will force all DBI connections to be made via that Gofer server. DESCRIPTION
This is the base class for all DBD::Gofer client transports. ATTRIBUTES
Gofer transport attributes can be specified either in the attributes parameter of the connect() method call, or in the DSN string. When used in the DSN string, attribute names don't have the "go_" prefix. go_dsn The full DBI DSN that the Gofer server should connect to on your behalf. When used in the DSN it must be the last element in the DSN string. go_timeout A time limit for sending a request and receiving a response. Some drivers may implement sending and receiving as separate steps, in which case (currently) the timeout applies to each separately. If a request needs to be resent then the timeout is restarted for each sending of a request and receiving of a response. go_retry_limit The maximum number of times an request may be retried. The default is 2. go_retry_hook This subroutine reference is called, if defined, for each response received where $response->err is true. The subroutine is pass three parameters: the request object, the response object, and the transport object. If it returns an undefined value then the default retry behaviour is used. See "RETRY ON ERROR" below. If it returns a defined but false value then the request is not resent. If it returns true value then the request is resent, so long as the number of retries does not exceed "go_retry_limit". RETRY ON ERROR
The default retry on error behaviour is: - Retry if the error was due to DBI_GOFER_RANDOM. See L<DBI::Gofer::Execute>. - Retry if $request->is_idempotent returns true. See L<DBI::Gofer::Request>. A retry won't be allowed if the number of previous retries has reached "go_retry_limit". TRACING
Tracing of gofer requests and responses can be enabled by setting the "DBD_GOFER_TRACE" environment variable. A value of 1 gives a reasonably compact summary of each request and response. A value of 2 or more gives a detailed, and voluminous, dump. The trace is written using DBI->trace_msg() and so is written to the default DBI trace output, which is usually STDERR. METHODS
This section is currently far from complete. response_retry_preference $retry = $transport->response_retry_preference($request, $response); The response_retry_preference is called by DBD::Gofer when considering if a request should be retried after an error. Returns true (would like to retry), false (must not retry), undef (no preference). If a true value is returned in the form of a CODE ref then, if DBD::Gofer does decide to retry the request, it calls the code ref passing $retry_count, $retry_limit. Can be used for logging and/or to implement exponential backoff behaviour. Currently the called code must return using "return;" to allow for future extensions. AUTHOR
Tim Bunce, <http://www.tim.bunce.name> LICENCE AND COPYRIGHT
Copyright (c) 2007-2008, Tim Bunce, Ireland. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. SEE ALSO
DBD::Gofer, DBI::Gofer::Request, DBI::Gofer::Response, DBI::Gofer::Execute. and some example transports: DBD::Gofer::Transport::stream DBD::Gofer::Transport::http DBI::Gofer::Transport::mod_perl perl v5.18.2 2013-06-24 DBD::Gofer::Transport::Base(3)
All times are GMT -4. The time now is 02:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy