Email inside cron

Bob Smith bob at netprt.com
Fri Aug 20 20:30:57 UTC 2004


Ooops, my bad.  I'm so embarassed!  I had this in a working script doing
exactly what was requested, and didn't look too closely.

Currently, when cron runs, the environment is very limited.  Here's an
example of what is set under the root user:

SHELL=
PATH=
_=
PWD=
HOME=
SHLVL=
LOGNAME=

When run under cron as a different user, at least on my system, the env
variable names are the same, although the user specific values are
different.  However, the environment that you have under normal operation
is very much larger, and includes aliases.  So you might check to see what
environment variables your version of mail uses, or what your version of
mail is aliased to.

-Bob


>
> On Aug 20, 2004, at 11:27 AM, Bob Smith wrote:
>
>> You might consider adding the -b flag to explicity set a source email
>> address.  You may find that LOGNAME or USER is not set in the cron
>> environment, and that may be part of the problem.  Try something like
>> this:
>>
>> /bin/mail -s "${MsgHeader} finished." ${MailTo} -b ${REAL_USER} <
>> ${logfile}
>>
>> -Bob
>>
>
> I'm curious as to which mail command uses the -b flag like that.  I'm
> running RHEL v3U2 and the man page says -b is for the BCC field...
>
> Jurvis LaSalle
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>





More information about the redhat-list mailing list