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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Ping Problem ashokmeti IP Networking 4 02-07-2008 05:42 AM
help help cronjob problem with script bucci Shell Programming and Scripting 4 02-10-2007 12:38 AM
ping problem vviscomi UNIX for Dummies Questions & Answers 1 12-22-2004 11:49 AM
Problem with cronjob... kswaraj Shell Programming and Scripting 1 07-14-2004 11:58 AM
Ping problem. system down!! TRUEST Shell Programming and Scripting 3 02-21-2003 11:16 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2003
Registered User
 

Join Date: Aug 2003
Location: Austria
Posts: 5
ping cronjob problem

Hi all,

I'm trying to write a shell script that will ping a site and and write the date and 1 or 0 (for success or no success) to a file.

it looks roughly like this:

#/bin/sh

set mydate = `date`
set myvar = `ping -c 1 hostname | grep -c "100%"`
if ($myvar == 1) then
echo $mydate" 0" >> banneruptime.txt
else
echo $mydate" 1" >> banneruptime.txt
endif

It works when I call it from the commandline, but not when i call it from a cronjob. On my MacOS X machine ping resides in /sbin, so I added that to the cronpath. But I get a "syntax error: unexpected end of file" error.

Any ideas? Thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-06-2003
Registered User
 

Join Date: Aug 2003
Location: Austria
Posts: 5
Call me stupid but I thought I had tried everything before posting. I got it to work, I was using /bin/csh in the script but /bin/sh in the cronjob. Added "SHELL=/bin/csh" and now it works.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0