On Wed, 7 Jun 2006, Hunter Walker wrote:

> So I should create a shell script that runs the command?  Can you provide an
> example?  Sorry, I am new at this...if you couldn't alreay tell.  :)

use something like this:


   harp:~ > cat /home/ahoward/bin/shush

   #! /usr/bin/env ruby

   $VERBOSE = nil

   stdin = ARGV.first == "-" and ARGV.shift
   command = stdin ? stdin.read : ARGV.join(" ")

   buf =
     IO.popen("bash --login", "r+") do |pipe|
       puts "{ #{ command } ;} 2>&1"
       pipe.puts "{ #{ command } ;} 2>&1"
       pipe.close_write
       pipe.read
     end

   exitstatus = $?.exitstatus

   puts buf unless exitstatus == 0 or exitstatus == 42

   exit exitstatus


this script runs it's command line under a bash login shell - so you'll have
your entire 'normal' environment available.  additionally it mops up any
output __unless__ the program fails - in which case it dumps it back out.
this is because cron emails it's user the output of any program - this way you
only get emails when programs fail.

regards.

-a
-- 
suffering increases your inner strength.  also, the wishing for suffering
makes the suffering disappear.
- h.h. the 14th dali lama