[comp.sys.apollo] Ping looses its ouput when run by cron

carlson (Carlson Peters) (03/22/91)

I have a ksh script that runs the the following ping command:

		ping node_name 64 3 1>ping.rpt

When I run the script from a shell or using 'at' all works fine.  However,
I really want to run this script from cron.  Problem is, ping.rpt is created
but empty when cron runs it.  When I tried this from a IBM risc station, it
ran without a hitch. What am I missing here?



-- 
Carlson Peters
(213) 481-7898
elroy.jpl.nasa.gov!ladwp!carlson

randall@bcstec.boeing.com (Michael Randall) (03/23/91)

In article <174@ladwp>, carlson (Carlson Peters) writes:
> I have a ksh script that runs the the following ping command:
> 		ping node_name 64 3 1>ping.rpt
> When I run the script from a shell or using 'at' all works fine.  However,
> I really want to run this script from cron.  Problem is, ping.rpt is created
> but empty when cron runs it.  When I tried this from a IBM risc station, it
> ran without a hitch. What am I missing here?


Cron runs /bin/sh by default. You didn't say here so I'm not sure, but
if you want a shell script to run a particular shell you must include
as the first line in the file, from column one, #!/bin/ksh (substitute
your favorite shell in for ksh).
#!/bin/csh
shell stuff.....

The difference in input re-direction could be part of your problem, I'm
not sure since I don't speak "ksh". Also, you should make sure you use a
complete path names to files, and not assume anything.  The less
assumptions the better/safer. The resulting shell script would look like
this:

#!/bin/ksh
/etc/ping node_name 64 3 1> /user/johndoe/ping.rpt

Let me know it that helps, (I do accept E-mail)  :)
-- 
-------------------- Peace Love & E-Mail ----------------------------------
  Michael W. Randall          |  Phone: (206) 965-9557
  randall@bcstec.boeing.com   |  This space for rent...
   ...!uunet!bcstec!randall   |                        ...Inquire within.