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
Ping Problem ashokmeti IP Networking 4 02-07-2008 09:42 AM
help help cronjob problem with script bucci Shell Programming and Scripting 4 02-10-2007 04:38 AM
ping problem vviscomi UNIX for Dummies Questions & Answers 1 12-22-2004 03:49 PM
Problem with cronjob... kswaraj Shell Programming and Scripting 1 07-14-2004 03:58 PM
Ping problem. system down!! TRUEST Shell Programming and Scripting 3 02-21-2003 03:16 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-06-2003
TylerDurden TylerDurden is offline
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.
 

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:32 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