The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Get date and time for past 1 hour from current date spch2o Shell Programming and Scripting 5 08-29-2008 05:32 AM
Processing a log file based on date/time input and the date/time on the log file primp Shell Programming and Scripting 4 03-16-2008 11:23 AM
To retrieve Date/Time from Windows by unix/linux boxes mpc8250 Shell Programming and Scripting 4 02-09-2008 12:31 AM
Linux Going Big Time and Prime Time Against Windows, UNIX (WSJ) (Addict 3D) iBot UNIX and Linux RSS News 0 06-21-2007 05:10 PM
Listing the creation date/time of a file in unix unipepper Shell Programming and Scripting 6 02-15-2006 07:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-25-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
Exclamation verify date and time on unix

Hello all,
I'm sorry for such a silly help.
I have 8 unix machines which include AIX, IRIX, HPUX, SGI.
I wanted a script that would compare/ check the date and time on all machine and send me a mail if some system has different date. how can i do it with a single script
It can check date and hour and if possb min.

I would be thanksful if any one could help me with this.

Regards,
Pradeep Kulkarni.
  #2 (permalink)  
Old 07-25-2005
amit_sapre amit_sapre is offline
Registered User
  
 

Join Date: Jun 2005
Location: Bangalore , INDIA
Posts: 28
Hi Pradeep,

To get the current time of any machine, try to read the data from port no 13.

For e.g. Using telnet :

Telnet <machine name> 13

Trying <I.P Address>...
Connected to <remote host>.
Escape character is '^]'.
Mon Jul 25 18:37:04 2005
Connection closed by foreign host.

U can get the current time for remote machine.

Regards,
Amit Sapre
  #3 (permalink)  
Old 07-25-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Why not use NTP (Network Time Protocol) to maintain time on all servers? Here is a link to info about NTP on HP servers, and here is a link to NTP on Sun.
  #4 (permalink)  
Old 07-25-2005
infierno's Avatar
infierno infierno is offline
Registered User
  
 

Join Date: Jul 2005
Location: Asuncion, Paraguay
Posts: 79
it is better to you run NTP on your UNIX hosts... and synchronize them with another NTP server on the internet, say time.nist.gov
  #5 (permalink)  
Old 07-30-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
Hello all,
Sorry for the delay in reply. i knew about NTP but i wantd a script that would post a mail to me about this information.
i did try Telnet <machine name> 13 and it works but how do i capture this data and put it in file and mail...???

Rgds,
Pradeep Kulkarni.
  #6 (permalink)  
Old 08-01-2005
madmat madmat is offline
Registered User
  
 

Join Date: Aug 2005
Location: Paris
Posts: 80
You could try this code :

toto=`telnet <machine name> 13`
datetime=`echo ${toto} | cut -d' ' -f10-`

Regards.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0