The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
retrieve file from windows server damn_bkb High Level Programming 1 01-21-2008 11:21 AM
Linux Going Big Time and Prime Time Against Windows, UNIX (WSJ) (Addict 3D) iBot UNIX and Linux RSS News 0 06-21-2007 04:10 PM
verify date and time on unix pradeepmacha Shell Programming and Scripting 6 08-02-2005 05:28 AM
text boxes, radio buttons , check boxes in c++ on unix devy8 High Level Programming 3 07-07-2001 05:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-08-2008
mpc8250 mpc8250 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 5
To retrieve Date/Time from Windows by unix/linux boxes

Hi

I have a unix box and a linux box.
I am writing a script that will get a date and time from a windows box which acts as a reference clock for the unix and linux boxes.
I can only ssh to the windows XP box from the unix/linux boxes.

This is my problem.

So I have
-bash-3.00# ssh x...@4.4.4.4 "cmd /c c:/\cygwin/\cygwin.bat date"
x...@4.4.4.4's password:


xyz@xyz_pc2 ~


But I'm not getting a response back with the date.


But if I


-bash-3.00# ssh x...@4.4.4.4 "cmd /c date /T "
x...@4.4.4.4's password:
Fri 02/08/2008


How can I retrieve the date and time from cygwin ?
I need that to format the date and time which XP DOS doesn't allow me
to.
thanks
Any help is appreciated


Ideally, I'm looking to retrieve a format that's like
YYYY/MM/DD HH:MM:SS format from Windows but its peculiarities
is difficult for me to get it right. I can't format DOS to what I like to achieve. Any suggestion to this ?

Any help is appreciated
Thanks
  #2 (permalink)  
Old 02-08-2008
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
DOS needs back slashes in directory paths to work, it looks like you are using forward slashes:

c:/\cygwin/\cygwin.bat date

if you have to escape backslashes in the bash code try:

c:\\cygwin\\cygwin.bat date
  #3 (permalink)  
Old 02-08-2008
HPAVC's Avatar
HPAVC HPAVC is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 106
Just suggestion, wouldn't it be better to setup something like Tardis and broadcast NTP from windows? Or if they aren't on the same network ntpdate from *nix to Windows via SSH (port forward)?

Seems like any work with scripting will just plain loose any time resolution.

Also you could have the *nix clients sync together as well as a pool.
  #4 (permalink)  
Old 02-08-2008
mpc8250 mpc8250 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 5
I'm getting this now.
Do you know what parameters in sshd.config file those 2 permissions are denying me ?

-bash-3.00# ssh xyz@4.4.4.4 "cmd /c date /T "
Permission denied (publickey,keyboard-interactive).

HV - I don't quite understand you meant in your reply.

Thnaks
  #5 (permalink)  
Old 02-09-2008
strike-2 strike-2 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 13
Perhaps you should try simply opening an (interactive) SSH session to that machine and back again.
That 'permission denied' error usually means one of the machines the SSH keys have not yet been exchanged both ways.

(You get that error a lot if you combine SSH/scp with sudo for local write permissions)


Also, you might need to change some permissions.
SSH daemons tend to log the reason they deny permission in their syslog file.
I know this file is called /var/log/secure in Linux, I have no idea what it is called in cygwin
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 10:13 PM.


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