Sponsored Content
Top Forums Shell Programming and Scripting Success/failure status of telnet connection Post 302534694 by DGPickett on Tuesday 28th of June 2011 01:43:56 PM
Old 06-28-2011
I usually spawn a watcher, which can detect lack of progress or hanging, and report and kill and restart. The watcher can be parent or nohup child &. You might need to log things very generously but simply to support the watcher. You could 'netstat -a ... |grep ...' to see the connection status, but timeout always seems to be a necessary precaution.
This User Gave Thanks to DGPickett For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Determining the failure or success of FTP

Hi there, I am in the process of writing a shell script to transfer files to a remote directory. Is there a method to determine the success or the failure of the ftp process. Regards Jim (4 Replies)
Discussion started by: JimJim
4 Replies

2. UNIX for Dummies Questions & Answers

Success status of mailx command

Hi I want to know if the email address in the mailx exists or not Eg: Mailx -s "Subj" hello@ab.com How do I know if the email address is a valid one??? (4 Replies)
Discussion started by: superprogrammer
4 Replies

3. UNIX for Advanced & Expert Users

Capturing sendmail success/failure?

I am working on a project that will use sendmail to send reports form a shell script. Since these reports are very important and go out at all times of the day, I need to be able to capture if sendmail is unsuccessful or errors out. The emails may have multiple recipients with multiple attachments.... (2 Replies)
Discussion started by: ssracer
2 Replies

4. AIX

telnet failure

My hardware is a JS21 IBM server with AIX 5.3L. I can console into the blade but at times I am able to telnet to a LDAP server on port 389, but then there are times I can not telnet to the port. I can't ping the server when I experience this issues. My application I support goes down in flames and... (3 Replies)
Discussion started by: billet75
3 Replies

5. Shell Programming and Scripting

How to Create a shell script to test the telnet connection status

Hi friends, I'm newbie to shell script. I wanted to create a shell script which able to write a result for all the telnet connection status. For example, from this machine I want to test the telnet connection (total 100+ servers) with this machine. Any idea how to write this shell script?... (16 Replies)
Discussion started by: yhcheong
16 Replies

6. Shell Programming and Scripting

Automating telnet checking for success/failure

Hi I wanna automate the telnet process for port connection.. # telnet 0 port_number Trying 0.0.0.0... Connected to 0. Escape character is '^]'. If its connected how to make it disconnect automatically.. And how to check for success or failure.. (0 Replies)
Discussion started by: ningy
0 Replies

7. Shell Programming and Scripting

How to write SCP success or failure to a file

Does anyone know how to write the results (success and failure) to a file. I am using TCSH on a Solaris machine. I have the following code for a successful SCP...could someone help me add to this so it caputres failures also? CODE SO FAR (received from a previous post): scp sourcefile.txt... (3 Replies)
Discussion started by: thibodc
3 Replies

8. UNIX for Dummies Questions & Answers

Check Success Status Of sed command

How do i check success status of a sed command execution i have the below script not sure if it is right approach to check status of execution using a function. Also it looks like in the below sed command even if the search string doesn't exist in the file it is returning status as success as i... (6 Replies)
Discussion started by: Ariean
6 Replies

9. Red Hat

Fedora 19 "useradd" failure, GUI success

Hey guys/gals, I have a Fedora 19 box with a 26TB RAID set mounted as my home directory # mount|grep home /dev/md0 on /home type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=128k,sunit=256,swidth=3584,noquota) I have been able to add/modify user accounts using VNC +... (4 Replies)
Discussion started by: jjinno
4 Replies

10. UNIX for Beginners Questions & Answers

Shell script to execute Oracle procedure and trigerring email on success and failure

Here is the shell script which need to trigger a stored procedure and when the record count is 0 then it should capture in the log that 0 duplicate records are found and if it's more than 0 then log with no of records. Also if there is any sqlerror then it should write the same in the log file and... (17 Replies)
Discussion started by: senmng
17 Replies
Config::Watch(3pm)					User Contributed Perl Documentation					Config::Watch(3pm)

NAME
Log::Log4perl::Config::Watch - Detect file changes SYNOPSIS
use Log::Log4perl::Config::Watch; my $watcher = Log::Log4perl::Config::Watch->new( file => "/data/my.conf", check_interval => 30, ); while(1) { if($watcher->change_detected()) { print "Change detected! "; } sleep(1); } DESCRIPTION
This module helps detecting changes in files. Although it comes with the "Log::Log4perl" distribution, it can be used independently. The constructor defines the file to be watched and the check interval in seconds. Subsequent calls to "change_detected()" will o return a false value immediately without doing physical file checks if "check_interval" hasn't elapsed. o perform a physical test on the specified file if the number of seconds specified in "check_interval" have elapsed since the last physical check. If the file's modification date has changed since the last physical check, it will return a true value, otherwise a false value is returned. Bottom line: "check_interval" allows you to call the function "change_detected()" as often as you like, without paying the performing a significant performance penalty because file system operations are being performed (however, you pay the price of not knowing about file changes until "check_interval" seconds have elapsed). The module clearly distinguishes system time from file system time. If your (e.g. NFS mounted) file system is off by a constant amount of time compared to the executing computer's clock, it'll just work fine. To disable the resource-saving delay feature, just set "check_interval" to 0 and "change_detected()" will run a physical file test on every call. If you already have the current time available, you can pass it on to "change_detected()" as an optional parameter, like in change_detected($time) which then won't trigger a call to "time()", but use the value provided. SIGNAL MODE Instead of polling time and file changes, "new()" can be instructed to set up a signal handler. If you call the constructor like my $watcher = Log::Log4perl::Config::Watch->new( file => "/data/my.conf", signal => 'HUP' ); then a signal handler will be installed, setting the object's variable "$self->{signal_caught}" to a true value when the signal arrives. Comes with all the problems that signal handlers go along with. TRIGGER CHECKS To trigger a physical file check on the next call to "change_detected()" regardless if "check_interval" has expired or not, call $watcher->force_next_check(); on the watcher object. DETECT MOVED FILES The watcher can also be used to detect files that have moved. It will not only detect if a watched file has disappeared, but also if it has been replaced by a new file in the meantime. my $watcher = Log::Log4perl::Config::Watch->new( file => "/data/my.conf", check_interval => 30, ); while(1) { if($watcher->file_has_moved()) { print "File has moved! "; } sleep(1); } The parameters "check_interval" and "signal" limit the number of physical file system checks, simililarily as with "change_detected()". COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-21 Config::Watch(3pm)
All times are GMT -4. The time now is 05:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy