Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Sep 2011 21:26:56 -0500
From:      Adam Vande More <amvandemore@gmail.com>
To:        Brett Glass <brett@lariat.net>
Cc:        questions@freebsd.org, Robert Bonomi <bonomi@mail.r-bonomi.com>
Subject:   Re: "at" command and mail
Message-ID:  <CA+tpaK2jbNoynCUGoBAm_GOPSz6ySiNjroTV-hwGpZyK=pug3w@mail.gmail.com>
In-Reply-To: <201109032142.PAA27491@lariat.net>
References:  <201109031639.KAA25689@lariat.net> <201109032035.p83KZfse010717@mail.r-bonomi.com> <201109032142.PAA27491@lariat.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sat, Sep 3, 2011 at 4:42 PM, Brett Glass <brett@lariat.net> wrote:

>
> One way to avoid problems would be to create a file name from a timestamp
> and a pid.
>
> The key thing, though, is to avoid mailing on machines that don't have
> mail.
>

Call a shell script which preforms the actions you want.

Regular old /bin/sh scripting is a worthwhile skill:

Something quick:

#!/bin/sh
OUTPUT=$(your/app)
if [ -e /usr/sbin/sendmail ]; then
  echo $OUTPUT | mail -s "Subject" $USER
else
  echo $OUTPUT > ${USER}_`date +\%Y\%m\%d`.log
fi

-- 
Adam Vande More



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CA+tpaK2jbNoynCUGoBAm_GOPSz6ySiNjroTV-hwGpZyK=pug3w>