The UNIX and Linux Forums  


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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-07-2007
fedora fedora is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 94
what is wrong with cron?

Hey, I have been fighting with this SIMPLE script for a while, and almost going to crazy!!

what I am doing is just get the DNS name for an IP, then echo the result,

under bash shell, I can do this using command line, without any problem,

$ a=`/usr/sbin/dig +short -x 216.239.37.104`
$ echo $a
va-in-f104.google.com.

Ok, so I wrote this in a script, ran it, no problem,

BUT , as long as I use cron to run this simple script, it give me nothing!

$ more /tmp/test.sh
#!/bin/bash
a=`/usr/sbin/dig +short -x 216.239.37.104`
echo "just confirm crontab execute this script" > /tmp/result
echo $a >> /tmp/result

$ more /tmp/result
just confirm crontab execute this script

$

what is the problem?