cron problem for getting the time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cron problem for getting the time
# 1  
Old 07-31-2007
cron problem for getting the time

Grateful if anyone could answer my question

The script called time.sh try to retrive the server time on another server and write into a files named "abc.123" as show below.

time.sh

#!/bin/sh
telnet 10.122.38.109 13 | tail -1 >/tmp/abc.123


The result when run on console or any active prompt is expected
Tue Jul 31 16:15:57 2007

However, when the script set as a cron, there is no time is being logged
Escape character is '^]'.

Could someone please give me a hand on this issue. Thank

regards,
darkrainbow
# 2  
Old 07-31-2007
can you try with tail -3
# 3  
Old 07-31-2007
Quote:
Originally Posted by srikanthus2002
can you try with tail -3
give the entire path of telnet in the script that u r putting in the cron....
i mean do a 'which telnet' and find out the path of telnet. Give this in ur script...
# 4  
Old 07-31-2007
Quote:
Originally Posted by srikanthus2002
can you try with tail -3
It did not log down any time information at all

more abc.123


Trying 10.122.38.109...
Connected to 10.122.38.109.
Escape character is '^]'.
# 5  
Old 07-31-2007
Quote:
Originally Posted by charu
give the entire path of telnet in the script that u r putting in the cron....
i mean do a 'which telnet' and find out the path of telnet. Give this in ur script...
The script has been amended
#!/bin/sh
which telnet >/tmp/abc.123
telnet 10.122.38.109 13 | tail -3 >>/tmp/abc.123

and here is the result

/usr/bin/telnet
Trying 10.122.38.109...
Connected to 10.122.38.109.
Escape character is '^]'.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

3. Solaris

System time and Cron time stamp not matching

On Solaris 10 server the system date won't match with the timestamp on files created by a cron jobs, Please help here is what i get when i check for system date infodba-ie10ux014:/tcpdv1_ie10/tcadmin/bin\n\r-> date Tue Apr 24 15:27:43 GMT 2012at same time i executed a cron job, and checked... (4 Replies)
Discussion started by: karghum
4 Replies

4. Shell Programming and Scripting

Running Cron -- same time jobs

Hi Is it possible to run different cron jobs at the same time? It appears that when I run ones at 15 min granularity that they may prevent ones running later in the day. Should crons run at same time have impact on one another? (4 Replies)
Discussion started by: rob171171
4 Replies

5. Shell Programming and Scripting

informix cron did not run for a certain time

currently i have this cron on my informix db 00 00,01,03,06,08,09,10,11,12,13,14,16,18,19,20,21,22,23 * * * . /informix/script.sh it was working until last february22, the last run was 1:00AM. It was suppose to run 3:00, 6:00, so on.. last night we restarted it and for some reason the cron... (2 Replies)
Discussion started by: lhareigh890
2 Replies

6. UNIX for Advanced & Expert Users

Completion time of a cron job ?

how can we identify the task completion time which was initiated by CRON. we have 1000 of jobs whihc are runing from cron so it is not feasable to edit every cron entry or every script to add the respective code to find teh completion time. Can some one please provide a inut to find the task... (3 Replies)
Discussion started by: NIMISH AGARWAL
3 Replies

7. UNIX for Dummies Questions & Answers

Unable to sftp with cron (once more time...)

Hi, I have been searching for older posts and I've found many entries with identical problems, but I was not able to find the solution (or when I thought I found it, my trial didn't worked :(). Anyway, here is my question. I wrote a sftp.sh file that runs perfect from command line. It uses scp... (6 Replies)
Discussion started by: Kronos
6 Replies

8. UNIX for Dummies Questions & Answers

Cron Time Setup

Hi Guys, can someone help me how to setup a job in cron that runs each morning from 8-10 a.m. for every half an hour but starting from 8:50 a.m.? so far i have this: 00,30 8-10 * * * but the problem is that it starts at 8:30 instead of 8:50 Anyone? Thanks! (1 Reply)
Discussion started by: netrom
1 Replies

9. Shell Programming and Scripting

Cron time format

Hi, i would like to ask if this cron is valid. 40 3-6,8-23 * * * /my command i want my job to run every hour on the 40th minute except 740am. Is this correct? (1 Reply)
Discussion started by: new2ss
1 Replies

10. UNIX for Dummies Questions & Answers

time zone and cron solaris 9

There is a posting similar to this but it does not list what resolved the issue. When I log into the server, it shows the correct timezone (edt) but when jobs run from cron, it shows GMT. Unix admin is looking for a solution. I am looking for a short term workaround to get the jobs... (2 Replies)
Discussion started by: MizzGail
2 Replies
Login or Register to Ask a Question